How to get URL from Python requests response

0 votes

Hi. I made a get request using the requests module using the following:

>>> r = requests.get('<url>', params=payload)

When I type this in the browser and search, it returns a different url. The same happens with the above code but I want to get the newly returned url. How to get it from the response.

May 14, 2019 in Python by Sam
684 views

1 answer to this question.

0 votes

Once you get the response, you'll find the url in the response. Try this:

>>> r = requests.get('<url>', params=payload)
>>> print(r.url)
answered May 14, 2019 by Firoz

Related Questions In Python

0 votes
1 answer

How to get text label from SAP using pywinauto[python]

Hi. Can you please tell me what ...READ MORE

answered Jun 28, 2018 in Python by Nietzsche's daemon
• 4,260 points
2,290 views
0 votes
3 answers

How to get the return value from a thread using python?

FWIW, the multiprocessing module has a nice interface for ...READ MORE

answered Dec 15, 2020 in Python by Roshni
• 10,520 points
105,131 views
0 votes
0 answers
0 votes
1 answer

How to exit from Python without traceback?

shutil has many methods you can use. One ...READ MORE

answered May 11, 2018 in Python by charlie_brown
• 7,720 points
619 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,023 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,409 views
0 votes
1 answer

How to get status code from Python Requests?

Here's how you can get the status ...READ MORE

answered May 14, 2019 in Python by Rasheed
1,768 views
0 votes
1 answer

How to pass query string in url using python requests?

You can pass the key-value pairs to ...READ MORE

answered May 14, 2019 in Python by Likith
6,589 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP