Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snirsh/requests_error_decorator
A simple decorator for python requests
https://github.com/snirsh/requests_error_decorator
Last synced: 18 days ago
JSON representation
A simple decorator for python requests
- Host: GitHub
- URL: https://github.com/snirsh/requests_error_decorator
- Owner: snirsh
- License: mit
- Created: 2022-01-19T20:55:11.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-19T21:20:16.000Z (almost 3 years ago)
- Last Synced: 2024-11-03T14:41:09.249Z (2 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# requests_error_decorator
A simple decorator for python requests## Example:
```python
import requests
from requests_error_handling_package.requests_error_decorators import requests_error_handler
from requests_error_handling_package.example import example@requests_error_handler
def foo():
"""
A function that shows a basic example.
"""
resp = requests.get("https://google.com/foo")
resp.raise_for_status() # THIS IS A MUST-DO STEP!
return respexample() # an example function that you can run yourself and see what the output looks like
```## Plans:
I'm planning to add more useful decorators to this repo :)
If you have any ideas, feel free to contact me!