Skip to content

dougkirkley/requests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

requests

Helper library for interacting with https and http endpoints with a python requests similarity

Quickstart Instructions

Install the library

go get github.com/dougkirkley/requests

Usage

Without https

package main

import (
    "log"
    "github.com/dougkirkley/requests"
    "github.com/dougkirkley/requests/https"
)

func main() {
    client := requests.NewClient(&https.CertInput{})
    resp, err := client.Get("https://api.helium.io/v1/blocks/height")
    if err != nil {
        log.Println(err)
    }
    log.Println(resp)
}

With https

package main

import (
    "log"
    "github.com/dougkirkley/requests"
    "github.com/dougkirkley/requests/https"
)

func main() {
    client := requests.NewClient(&https.CertInput{
        CaCert: "cacerts.pem",
        KeyFile: "key.pem",
        CertFile: "cert.pem",
    })
    resp, err := client.Get("https://api.helium.io/v1/blocks/height")
    if err != nil {
        log.Println(err)
    }
    log.Println(resp)
}

About

Go Python like Requests library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages