Jed Rembold
November 19, 2025
json.loads(|||your string response|||) to
convert this to nested data structuresimg/|||scene_key|||.jpgengineer_storyinfinite_ethics.txt and uploaded along with
your code
jedrembold.prof
/polling endpoint sends back the polling
page HTML/daily_results endpoint might send back
a JSON dictionary of all the responses from the day/new_poll endpoint might tell the server
to start a new pollrequest libraryYour browser can make GET requests, but how can we handle GET and POST requests in Python?
requests library!pip
Import, and then functions for both GET and POST style requests:
import requests
resp = requests.get(|||URL|||)
resp2 = requests.post(|||URL|||, |||payload|||)Response class
object| attribute/method | Details |
|---|---|
| text | Gets the content in a string format |
| content | Gets the content in bytes |
| json() | Returns parsed JSON content |
| status_code | Returns a numeric code for how the request went |
| reason | Returns text explaining the numeric code |
GET requests are also what are done by the browser, so we can use them to access either webpage content or API content
If grabbing webpage content, use
.text to retrieve just the HTML
resp = requests.get("polling.jedrembold.prof")
html = resp.textIf grabbing API content, you usually will want to use
.json() to convert response to a Python data
structure
resp = requests.get(
"http://api.open-notify.org/astros.json"
)
content = resp.json()https://restcountries.com/v3.1/name/{name}payload = {"name": "Jed", "class": "CS151"}
resp = requests.post(|||URL|||, json=payload)https://jsonplaceholder.typicode.com/postsjson.loads(|||str of json|||) to convert
that string into a Python data structure that you can work easily
with