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 13 in Python by Sam
5 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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 13 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
203 views
0 votes
1 answer

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

You don't need to change your existing ...READ MORE

answered Dec 3, 2018 in Python by Nymeria
• 3,500 points

edited Dec 19, 2018 by Nymeria 3,737 views
0 votes
1 answer

How to exit from Python without traceback?

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

answered May 10, 2018 in Python by charlie_brown
• 7,710 points
79 views
0 votes
1 answer

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

answered Jun 4, 2018 in Python by ariaholic
• 7,320 points
47 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
20 views
+4 votes
6 answers
0 votes
1 answer

How to get status code from Python Requests?

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

answered May 13 in Python by Rasheed
8 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 13 in Python by Likith
3 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.