Python Requests

High-level library to interact with HTTP servers.

Based on the library urllib3.

Why use?

  • Keep-Alive and connection pooling.

  • Sessions with cookie persistence.

  • Digest/Basic authentication.

  • File upload using Multipart.

GET

import requests

if __name__ == "__main__":
    r = requests.get("https://www.ua.pt/manifest.json")
    print(r.text)

Or better.

if __name__ == "__main__":
    r = requests.get("https://www.ua.pt/manifest.json")
    data = r.json()
    print(data["name"])

POST

POST of a file

Last updated