Header support in urllib or requests
Posted: Thu Jun 09, 2016 2:38 pm
Looking at the urllib.urequest code, it seems there is no header support at all. That's the reason why my current request is failing. Is there a chance to get header support implemented soon?
import urllib.urequest
endpoint = 'https://api.yaas.io/hybris/oauth2/b1/token'
urlencoded = 'grant_type=client_credentials&scope=&client_id=xxx&client_secret=xxx'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
response = urllib.urequest.urlopen(endpoint, data=urlencoded, method="POST")
json = response.read()
//FAILS - no Content-Type specified and the API does not seem to support it right now.
import urllib.urequest
endpoint = 'https://api.yaas.io/hybris/oauth2/b1/token'
urlencoded = 'grant_type=client_credentials&scope=&client_id=xxx&client_secret=xxx'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
response = urllib.urequest.urlopen(endpoint, data=urlencoded, method="POST")
json = response.read()
//FAILS - no Content-Type specified and the API does not seem to support it right now.