Skip to main content

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

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)

Source distribution for python-requestr 0.16
File Size Uploaded
python_requestr-0.16.tar.gz 4.7 kB Details

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

Release history Release notifications | RSS feed

This release

0.16 This release

1 release file

0.15

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page