dmakhno/travis_after_all

HTTP Error 404: Not Found

winterDroid opened this issue · 6 comments

When I try to use this script, I get all the time an HTTP Error 404: Not Found error when I try to get the access token with my github token. Do you have an idea why?

Seems to be the same like #2

It seems that travis now requires a 'user-agent' and 'accept' header - see https://docs.travis-ci.com/api#making-requests

I recently started getting this as well. @winterDroid Did you solve this by providing those headers in the request made from the script?

@dleve123 Yes I solved this by providing a user agent. But you need to contact the travis support before so that they can whitelist your user agent.

@winterDroid Wonderful, thanks for the info. Of course that's not included in the docs:

Always set the User-Agent header. This header is not required right now, but will be in the near future. Assuming your client is called “My Client”, and it’s current version is 1.0.0, a good value would be MyClient/1.0.0. For our command line client running on OS X 10.9 on Ruby 2.1.1, it might look like this: Travis/1.6.8 (Mac OS X 10.9.2 like Darwin; Ruby 2.1.1; RubyGems 2.0.14) Faraday/0.8.9 Typhoeus/0.6.7.

Were you able to add the proper User-Agent and Accept headers with the following (after contacting Travis support)?

opener = urllib2.build_opener();
opener.addheaders = [('User-agent', '#{my_user_agent}/1.0.0'), ('Accept', 'application/vnd.travis-ci.2+json')]
opener.open(url).read()

Python isn't my forté, so just doubling checking that I'm not missing something!

Thanks!

Update:

Setting the Accept and User-Agent headers didn't solve this issue for me. Switching from URL based token auth to header based auth (the Authorization header) did though.