I'm running into an issue when using Go's http client to download a zip or tar.gz file from Github. I get a 403 with the message "Your access to this site has been restricted".
Curl works fine though.
I am running this in an EC2 instance on AWS in the us-west-2 region. In particular,
Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-0807918df10edc141 (64-bit x86) / ami-0c75fb2e6a6be38f6 (64-bit Arm)
Info
- Go: go1.15.linux-amd64 (tried it on 14 too)
- AWS - Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-0807918df10edc141 (64-bit x86) / ami-0c75fb2e6a6be38f6 (64-bit Arm)
- Endpoint: https://github.com/kubeflow/manifests/archive/v1.0.2.tar.gz (I've tried it with others too, none work)
Sample code to reproduce:
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
endpoint := "https://github.com/kubeflow/manifests/archive/v1.0.2.tar.gz"
// or https://api.github.com/repos/kubeflow/manifests/zipball/v0.12.0
// Get the data
resp, err := http.Get(endpoint)
if err != nil {
fmt.Printf("[error] %v", err)
return
}
defer resp.Body.Close()
respData, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Printf("[error] %v", err)
return
}
// Returns a 403 and html error page
fmt.Printf("Resp:\n%v\n", string(respData))
}
Note: the above works fine on my local machine, it just seems to stop in the aws instance.
Thanks!
Authorization: token <value>
header? developer.github.com/v3/#authentication – evilSnobu