requestr
A wrapper library for requests, optimised for JSON and HTML
Installation:
pip install python-requestr
import requestr
url = 'https://jsonplaceholder.typicode.com/posts/1'
response = requestr.get(url)
>>> response.data
{
'userId': 1,
'id': 1,
'title': 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
'body': 'quia et suscipit...'
}
>>> response.data.title
'sunt aut facere repellat provident occaecati excepturi optio reprehenderit'
import requestr
url = 'https://example.com'
response = requestr.get(url)
h1_tag = response.soup.select_one('h1')
>>> h1_tag.text
'Example domain'
from requestr import Session
session = Session()
url = 'https://jsonplaceholder.typicode.com/posts/1'
response = session.get(url)
>>> response.data
{
'userId': 1,
'id': 1,
'title': 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
'body': 'quia et suscipit...'
}
>>> response.data.id
1
from requestr import requestr_futures
from time import sleep
url = 'https://jsonplaceholder.typicode.com/posts/1'
future = requestr_futures.get(url) # Request is executed in background thread without blocking code execution
sleep(3)
response = future.result()
>>> response.data
{
'userId': 1,
'id': 1,
'title': 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
'body': 'quia et suscipit...'
}
>>> response.data.title
'sunt aut facere repellat provident occaecati excepturi optio reprehenderit'
from requestr import FuturesSession
from time import sleep
session = FuturesSession()
url = 'https://jsonplaceholder.typicode.com/posts/1'
response = session.get(url) # Request is executed in background thread without blocking code execution
sleep(3)
response = future.result()
>>> response.data
{
'userId': 1,
'id': 1,
'title': 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
'body': 'quia et suscipit...'
}
>>> response.data.id
1
Metadata
Release files for python-requestr 0.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_requestr-0.16.tar.gz | 4.7 kB | Without provenance | Details for python_requestr-0.16.tar.gz |
Release files / python_requestr-0.16.tar.gz
| Download URL | python_requestr-0.16.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
656bcd451df7036dde76c693ea47b22f6b3eb183085b1cfac9dcdec28e6a64da
|
|
BLAKE2b-256 checksum How to use checksums |
692c8f141fab659ff60818cf7f19b6d84e3bc38a69b3f5794e47f7b317dc89fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for python-requestr 0.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.