https://github.com/dlrsp/django-requests-api
Django application to provide simple and shared requests client.
https://github.com/dlrsp/django-requests-api
Last synced: about 1 year ago
JSON representation
Django application to provide simple and shared requests client.
- Host: GitHub
- URL: https://github.com/dlrsp/django-requests-api
- Owner: DLRSP
- License: mit
- Created: 2023-06-23T20:58:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-15T08:11:45.000Z (over 1 year ago)
- Last Synced: 2024-11-15T09:24:19.343Z (over 1 year ago)
- Language: Python
- Homepage: https://dlrsp.github.io/django-requests-api/
- Size: 901 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# django-requests-api [](https://pypi.python.org/pypi/django-requests-api)
[](https://pypi.python.org/pypi/django-requests-api)
[](https://pypi.python.org/pypi/django-requests-api)
[](https://pypi.python.org/pypi/django-requests-api)
[](https://pypi.python.org/pypi/django-requests-api)
[](https://pypi.python.org/pypi/django-requests-api)
[](https://pypi.python.org/pypi/django-requests-api)
## GitHub  
## Test [](https://codecov.io/github/DLRSP/django-requests-api?branch=master) [](https://results.pre-commit.ci/latest/github/DLRSP/django-requests-api/master) [](https://github.com/DLRSP/django-requests-api/actions/workflows/ci.yaml)
## Check Demo Project
* Browser the demo app on-line on [Heroku](https://django-requests-api.herokuapp.com/)
* Check the demo repo on [GitHub](https://github.com/DLRSP/example/tree/django-requests-api)
## Requirements
- Python 3.8+ supported.
- Django 3.2+ supported.
## Setup
1. Install from **pip**:
```shell
pip install django-requests-api
```
2. Modify `settings.py` by adding the app to `INSTALLED_APPS`:
```python
INSTALLED_APPS = (
# ...
"requests_api",
# ...
)
```
## Usage
```shell
from requests_api import RequestsApi
client = RequestsApi("https://api.publicapis.org")
r = client.get("/entries")
print(r.json())
github = RequestsApi("https://api.github.com", headers={"Authorization": "token abcdef"})
r = github.get("/user", headers={"Accept": "application/json"})
print(r.text)
```
## Run Example Project
```shell
git clone --depth=50 --branch=django-requests-api https://github.com/DLRSP/example.git DLRSP/example
cd DLRSP/example
python manage.py runserver
```
Now browser the app @ http://127.0.0.1:8000