python - requests.history returning empty output on Zapier -
within 'code zapier'-zap i'm trying check url redirection. requests-package doesn't seem hand me history.
import requests response = requests.get('http://www.google.com', allow_redirects=true) response.raise_for_status() return [{'response':response.history}]
this code returns empty outpout time. zapier says requests
-package available on service.
anyone able tell me i'm doing wrong here? or not available on zapier?
david here, zapier platform team.
requests indeed available in our python code step! part working fine.
per documentation, response.history
fills array if redirects happened. picked unfortunate example, turns out can access google on http:
% curl http://www.google.com -i http/1.1 200 ok ...
if access without www
, see redirect you're expecting:
% curl http://google.com -i http/1.1 301 moved permanently location: http://www.google.com/
you can see evident in python code well:
>>> import requests >>> response = requests.get('http://google.com') # redirects default >>> response.history [<response [301]>]
let me know if you've got other questions!
Comments
Post a Comment