What are query strings? How do I use them? In this lesson you’ll learn exactly that. The .get()
function accepts a params
argument, which can be a dictionary, a list of tuples or raw bytes. The following example uses the GitHub Search API looking for the requests
library:
>>> requests.get(
... 'https://api.github.com/search/repositories',
... params={'q': 'requests+language:python'}
... )
<Response [200]>
agerbes on March 14, 2020
Dear Christopher Bailey,
thank you very much for the great tutorial.
I have a special question.
Using the request library I print out the result of the url = ‘www.dropbox.com/h?preview=ophelp.txt‘
I would like to store the content of this url into it’s name = ‘ophelp’.
How can I use the request library to get the name searching for ‘preview=’ and getting ‘ophelp’?
I thought about using the query string parameters as you shown in your tutorial. But I am not sure how to search for it exactly.
Thank you Anja