Here's my WORKSPACE:
~python
http_archive(
name = "boat_thing",
url = "http://www.thingiverse.com/thing:763622/zip",
)
~
and BUILD:
~python
filegroup(
name = "boat_cad",
srcs = [
"@boat_thing//:3DBenchy.stl",
],
)
~
When I run bazel build, it attempts to download the zip file from thingiverse, but fails with an "Access Denied" error. The html of the error page is printed out, which contains:
~txt
The owner of this website (www.thingiverse.com) has banned your access based on your browser's signature (306694fb44271e77-ua21)
~
Is it possible to change the user agent / "signature" that bazel uses to download remote files? I can download zip files from thingiverse with wget just fine, but I can't figure out a way to do it with bazel.
A new change is going to be pushed soon that will allow you to mirror this file and add the mirror URL to the urls list of http_archive.
Seems like Bazel should set the user-agent to something reasonable, though.
Bazel sets the user-agent to Java/1.x.x.etc on my computer. I've confirmed the server in question blocks this. However if I do the following:
$ curl -I -H 'User-Agent: curl/7.0.0 Bazel/0.4.0' http://www.thingiverse.com/thing:763622/zip
HTTP/1.1 302 Found
...
It works.
Yeah it's kind of strange, it seems to just not like the "Java/" in the User-Agent. I tried hard-coding the user-agent and rebuilding bazel and it works great. See https://github.com/justbuchanan/bazel/commit/45586a77f5ad3754fad8cc0736fd6a82a12f7aec.
Oh really? So in that case we might be able to just make the user-agent Bazel/VERSION without the curl.
Does ed7ced0018dc5c5ebd6fc8afc7158037ac1df00d actually address this? It doesn't seem to do anything related to user-agents
It does not.
I can put together a pull request for this if it's something you'd like to include in bazel. Maybe as @jart suggested, the User-Agent could be set to Bazel/{{VERSION}}?
That would be great, thanks!
@justbuchanan Just reviewed your change. Thanks for making it. Please consider making that change here.