https://github.com/snirsh/requests_error_decorator
A simple decorator for python requests
https://github.com/snirsh/requests_error_decorator
Last synced: 11 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-19T21:20:16.000Z (over 3 years ago)
- Last Synced: 2025-04-07T20:43:45.801Z (3 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!