pyscript
pyscript copied to clipboard
The novice tutorial reports no patch() attribute
Checklist
- [X] I added a descriptive title
- [X] I searched for other issues and couldn't find a solution or duplication
- [X] I already searched in Google and didn't find any good information or help
What happened?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Requests Tutorial</title>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-config>
packages = ["requests", "pyodide-http"]
</py-config>
<py-script>
import requests
import pyodide_http
# Patch the Requests library so it works with Pyscript
pyodide_http.patch()
# Make a request to the JSON Placeholder API
response = requests.get("https://jsonplaceholder.typicode.com/todos")
print(response.json())
</py-script>
</body>
</html>
URL:https://docs.pyscript.net/latest/tutorials/requests.html

What browsers are you seeing the problem on? (if applicable)
No response
Console info
No response
Additional Context
No response
Thank you for raising this issue, I have #1264 which fixed this tutorial, unfortunately it seems we didn't merge it before we did the release.
For context I have fixed the tutorial and the fix is live in the unstable version of the docs: https://docs.pyscript.net/unstable/tutorials/requests.html
But we need to deploy so this fix is pushed to the latest version 😃
I hope we deployed in the meantime 😅