grab
grab copied to clipboard
server returned 403 Forbidden
resp, err := grab.Get(".", "some-zip-file")
if err != nil {
log.Info(err)
}
This gives the error server returned 403 Forbidden
Try with https://github.com/cavaliergopher/grab/archive/refs/tags/v3.0.1.zip
, it'll show you the error
I've only seen this happen on downloads from github, and it's caused by the default user agent (which is "grab"
), not sure why it's blocked. Changing it to anything else solves this issue.
In your example, this can be achieved by adding grab.DefaultClient.UserAgent="non-default-user-agent"
before the call to grab.Get