How to get redirecting url with status code 400

This is the place for queries that don't fit in any of the other categories.

How to get redirecting url with status code 400

Postby fazeelama » Tue May 27, 2014 5:38 am

Hello all,I am very much new to this forum and python language
I have a tried request, urllib2 packages to get the redirecting url. I have also passed header s for getting the url. iam getting the status code as 200 but not the redirected url. How to get it ? Here is my code :

Code: Select all
import requests
>>> url = "http://www.india.gov.in/redirect=http%3A%2F%2Fmohfw.nic.in&nid=MjU3NTBuZXducGk="
headers = {"Referer": "http://india.gov.in/topics/health-family-welfare/health"}
>>> req = requests.get(url, headers=headers)
>>> req
Last edited by micseydel on Tue May 27, 2014 5:42 am, edited 1 time in total.
Reason: Code tags, lock.
fazeelama
 
Posts: 1
Joined: Tue May 27, 2014 5:35 am

Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot] and 5 guests