google app engine - Urlfetch is not following some redirects -
i'm experiencing issue urlfetch. seems url used in code, follow_redirects=true works locally.
here's code used testing:
def redirect_test(): url = 'http://0214.by/job.php?busy=ПОСТОЯННАЯ' response = urlfetch.fetch(url, follow_redirects=true) if 'location' in response.headers: ret = 'redirect ignored. location: %s<br>' % response.headers['location'] url = urlparse.urljoin(url, response.headers['location']) response = urlfetch.fetch(url, follow_redirects=false) if 'location' in response.headers: ret += 'redirect followed manually , redirect response received' else: ret += 'redirect followed manually , no more redirects received' else: ret = 'redirect followed automatically' return ret the problem when i'm running code locally i'm getting "redirect followed automatically" message. when deployed on google app engine, "redirect followed manually , no more redirects received" message shown.
the url returns redirect https page.
it makes me think redirect followed expected when running locally reason. appreciate ideas on caused by.
wiki
Comments
Post a Comment