Hi, I am using the requests module to access the rest api of IronWorker. The code works from local machine, but gives the following error in pythonanywhere:
ERROR The requested URL could not be retrieved The following error was encountered while trying to retrieve the URL: https://worker-aws-us-east-1.iron.io/2/projects/5225ee865fc8c50005000003/tasks Unsupported Request Method and Protocol Squid does not support all request methods for all access protocols. For example, you can not POST a Gopher request.
I checked the whitelist, and .iron.io is indeed in the list. I've seen mentioned that requests module might have a bug that's to do with urllib3, is this it? If so, how do I override it? I have a free account.
My code (the oath token is deleted):
url = "https://worker-aws-us-east-1.iron.io/2/projects/5225ee865fc8c50005000003/tasks"
payload = {'tasks' : [{'code_name':'try','payload':'{"var1": "val1"}'}] }
headers = { 'Content-Type' : 'application/json',
'Accept' : 'application/json',
'Accept-Encoding' : 'gzip/deflate',
'Authorization' : 'OAuth x*****************4' }
logger.info("Queueing worker with payload: "+str(payload))
response = requests.post(url,data=simplejson.dumps(payload),headers=headers)
Thanks, Jonathan.