requestr
Project description
requestr
A wrapper library for requests, optimised for JSON and HTML
Installation:
pip install 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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-requestr-0.12.tar.gz
(4.1 kB
view details)
File details
Details for the file python-requestr-0.12.tar.gz.
File metadata
- Download URL: python-requestr-0.12.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10c1958d45ffb816515f25149cd2880a7fdefb9434420fba2d33edec25bb5693
|
|
| MD5 |
395ed226785a84bbcf1033dd5d318677
|
|
| BLAKE2b-256 |
4375c5347ce42bfed255f694e70bb5ca257986efcfa61429e17745bb47686ae4
|