4

Doing a requests.post with params returns 401

If I print request.url and follow it in a browser it works just fine.

The authorization is provided as an api key in an url parameter.

I can't figure out why the url would work just fine in the browser but not via requests. To clarify the url i'm following is the one that requests has built.

JerodG
  • 1,248
  • 1
  • 16
  • 34
  • 2
    In a browser or in the browser? I guess your browser has some cookies set. Trace the requests in the dev console and replicate the request with all the headers in Python. – warvariuc Oct 13 '17 at 18:39
  • 1
    Try a private/incognito session on the browser to rule out cookies, if it still works try changing the user agent in requests – Dalvenjia Oct 13 '17 at 18:50
  • Tried incognito; still works. Using chrome. – JerodG Oct 13 '17 at 19:17
  • Figured it out; apparently despite the documentation that states, requests can be made either post/get only get works, had trouble noticing this before as they return invalid json. Thanks for the suggestions. – JerodG Oct 13 '17 at 19:29

0 Answers0