Skip to content

The novice tutorial reports no patch() attribute #1291

@ChinaGodzilla

Description

@ChinaGodzilla

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • 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

image

What browsers are you seeing the problem on? (if applicable)

No response

Console info

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

tag: docsRelated to the documentationtype: bugSomething isn't workingwaiting for releaseBugs and features already landed but not released yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions