Skip to main content

Warp Requests with Retrying, so some important requests could easily retry when encounter error

Project description

📦 CareHttp

CareHttp cares your data.

It wraps from Requests and Retrying, retry several times when you encounter requests error.

Installation

pip3 install carehttp

Usage

example1 print the url:

from carehttp import Carehttp

r = Carehttp().get(url='https://stackoverflow.com/', timeout=0.1)
print(r.text)

r = Carehttp().post('https://stackoverflow.com/', data={}, json={}, timeout=1)
print(r.text)

example2 print a title:

s = requests.Session()
r = Carehttp(session=s, mark='title').get('https://stackoverflow.com/', timeout=1)
print(r.text)

example3 custom retry setting:

r = Carehttp(mark='title', tries=10, delay=1, max_delay=60).get('https://stackoverflow.com/', timeout=1)
print(r.text)

How to use carehttp

  • It's a combination from Requests and Retrying, only add a param mark
  • Request part is exactly the same params with Requests.
  • Retry part termed params. Usage more like Retry.
  • If ignore mark, error displays the url, or else display the text of mark.

What else

  • More functions is planning.

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

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

carehttp-0.3.11.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file carehttp-0.3.11.tar.gz.

File metadata

  • Download URL: carehttp-0.3.11.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for carehttp-0.3.11.tar.gz
Algorithm Hash digest
SHA256 95913b376adcbe0966cc97b21721b4a4080d7a827e6f745ae48b951c21e8b037
MD5 cb8e93555792732da82b0f65de6cfdce
BLAKE2b-256 532a208fdcfb2e2c9ac83d326fb14f0e304795e081ee778ba89872dad2c01c0f

See more details on using hashes here.

Supported by

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