Requests for all
Project description
poet-api
Requests with Limiter.
Uses pyrate_limiter.SQLiteBucket with use_file_lock=True.
It can handle many connections concurrently and respect the chosen limits per_second, per_minute, per_day.
class Communicate
init
session: requests.Session(Required)caller_name: str (limiter id)(Required)per_second: int = 1per_minute: int = 56per_day: Optional[int] = Nonestream: bool = Falsetimeout: Union[float, tuple] = 5allow_redirects: bool = True
send
method: str(Required)url: str(Required)headers: Optional[dict] = None(default headers are sent if None)**kwargs(accepted byrequests.Request)
Examples
-
Simplest (by default: 56 requests per minute, 1 request per second):
from api import Communicate from requests import Session session = Session() response = Communicate(session=session, caller_name="simple_john").send( method="GET", url="https://john-site.com" ) -
With custom limits and custom headers:
from api import Communicate from requests import Session session = Session() headers = {"User-Agent": ("My Dear Agent v.1")} response = Communicate(session=session, caller_name="John", per_minute=6).send( method="GET", url="https://mysite.com", headers=headers )
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
poet_api-3.0.0.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file poet_api-3.0.0.tar.gz.
File metadata
- Download URL: poet_api-3.0.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.1.0-40-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d283dac2a20082007c0e4996fe2943bc40cb21ab9d7c6a46c8e5e7ef1c13cd2
|
|
| MD5 |
45f08347438e59da10acc0f54268a6e4
|
|
| BLAKE2b-256 |
2e0aafa88b06f7e62fc354ac53519ca8c05768623011c5c8f930a5349dfeadcc
|
File details
Details for the file poet_api-3.0.0-py3-none-any.whl.
File metadata
- Download URL: poet_api-3.0.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.1.0-40-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3be0784fc0c3fc67569e71b5de6f47e638ac942e49e9870fd262b3da4cd618bb
|
|
| MD5 |
57a75883920ead84f0c88505f0a9e687
|
|
| BLAKE2b-256 |
e2c59de386e55b11900391b41b3be463253c0adb5da5635aa8aaffabc01095d1
|