Search the courses, subjects, tracks, games and features, or jump straight to a page.
5 cards from this section. Quick, good the night before a test.
What is a GET request used for, and which function in the requests library sends one?
Think about which way the data travels: from the server to your program.
What is a GET Request? Explain why it is described as safe and idempotent.
Ask yourself what happens on the server if the same request arrives twice.
Which argument of requests.get() adds query parameters to the URL?
The name is short for "parameters".
Which status code does a successful GET request normally return?
It is the plain "OK" code.
Fetch every post written by user 1 and print the titles, then restructure the code so that it can be tested without a network.
A function that receives `get` as an argument does not care whether it is `requests.get` or a stand-in.
Using only the standard library, write build_get_url(base, params) that returns the URL a GET with params would request. It must escape special characters and, when the base URL already has a query string, add the new pairs with &.
`urlsplit`, `parse_qsl`, `urlencode` and `urlunsplit` from `urllib.parse` do most of the work.
6 more questions in this section. Enroll free to practise them all.
Enroll free