In my program, I am trying to access https://api.dropbox.com/1/oauth2/token
. In order to do that, I was trying to use http.client.HTTPSConnection()
. However, I am receiving a 400 statement from the server, even though when I send the same request through my browser, I get an actual response:
{"error": "Call requires one of the following methods: POST, OPTIONS. Got GET."}
I believe that this happens for subdomains, since I also tested the function for https://docs.python.org/3/
, and the result is very similar.
Here is my code (Python3):
conn = http.client.HTTPSConnection('docs.python.org')
conn.request('get', '/3/')
response = conn.getresponse().read()
print(response)
How should I use the http.client
library to send the proper request?