grab icon indicating copy to clipboard operation
grab copied to clipboard

server returned 403 Forbidden

Open Prateeknandle opened this issue 1 year ago • 1 comments

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

Prateeknandle avatar Sep 08 '23 10:09 Prateeknandle

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

cfergeau avatar Sep 12 '23 07:09 cfergeau