Skip to main content

Requests for all

Project description

poet-api

Requests with Limiter

class Communicate

init

  • session: requests.Session (Required)
  • caller_name: str (limiter id) (Required)
  • limiter: Optional[Limiter] = None (Default limiter uses FileLockSQLiteBucket56 requests/minute)
  • stream: bool = False
  • timeout: Union[float, tuple] = 5
  • allow_redirects: bool = True

send

  • method: str (Required)
  • url: str (Required)
  • headers: Optional[dict] = None (default headers are sent if None)
  • **kwargs (accepted by requests.Request)

Examples

  • Simplest:

    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 limiter:

    from api import Communicate
    from pyrate_limiter import Duration, FileLockSQLiteBucket, Limiter, RequestRate
    from requests import Session
    
    session = Session()
    limiter = Limiter(RequestRate(0.5, Duration.SECOND), bucket_class=FileLockSQLiteBucket)
    headers = {"User-Agent": ("My Dear Agent v.1")}
    
    response = Communicate(session=session, caller_name="John", limiter=limiter).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-1.2.18.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poet_api-1.2.18-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file poet_api-1.2.18.tar.gz.

File metadata

  • Download URL: poet_api-1.2.18.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.1.0-40-amd64

File hashes

Hashes for poet_api-1.2.18.tar.gz
Algorithm Hash digest
SHA256 aa87537feac4c5bb3e19046a5ece567a0da1ab8c376fb22f5c15905ad8c214c2
MD5 3464103fc0974dcc12ad2c80628c45d5
BLAKE2b-256 93716487b7e74ce27f152c87a0ffdd70a999525057c2efa4c6a98b2d4b62b516

See more details on using hashes here.

File details

Details for the file poet_api-1.2.18-py3-none-any.whl.

File metadata

  • Download URL: poet_api-1.2.18-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.1.0-40-amd64

File hashes

Hashes for poet_api-1.2.18-py3-none-any.whl
Algorithm Hash digest
SHA256 61a7bd559a662f0b5f3155b2e178c09bd63f5b1f1039ca74eab8569c13edab96
MD5 b9a861526975ed24d52b184317cc50b6
BLAKE2b-256 a027c9743cf94bc0d92341a105135808a97abb5084496c66f49495aa63245f34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page