django-requests-api 0.6.2__tar.gz → 0.6.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/.pre-commit-config.yaml +14 -9
- django_requests_api-0.6.6/CHANGELOG.rst +17 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/CODEOWNERS +1 -1
- django_requests_api-0.6.6/PKG-INFO +170 -0
- django_requests_api-0.6.6/README.md +122 -0
- django_requests_api-0.6.6/mkdocs.yml +66 -0
- django_requests_api-0.6.6/pyproject.toml +182 -0
- django_requests_api-0.6.6/requirements/py310-django42.txt +212 -0
- django_requests_api-0.6.6/requirements/py310-django52.txt +212 -0
- django_requests_api-0.6.6/requirements/py311-django42.txt +208 -0
- django_requests_api-0.6.6/requirements/py311-django52.txt +208 -0
- django_requests_api-0.6.6/requirements/py312-django42.txt +208 -0
- django_requests_api-0.6.6/requirements/py312-django52.txt +208 -0
- django_requests_api-0.6.6/requirements/py313-django52.txt +208 -0
- django_requests_api-0.6.6/requirements/py314-django52.txt +208 -0
- django_requests_api-0.6.6/setup.cfg +4 -0
- django_requests_api-0.6.6/src/django_requests_api.egg-info/PKG-INFO +170 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/django_requests_api.egg-info/SOURCES.txt +4 -10
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/django_requests_api.egg-info/requires.txt +2 -1
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/requests_api/__init__.py +12 -2
- django_requests_api-0.6.6/src/requests_api/conf.py +71 -0
- django_requests_api-0.6.6/src/requests_api/defaults.py +16 -0
- django_requests_api-0.6.6/src/requests_api/helpers.py +81 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/requests_api/requests_api.py +29 -9
- django_requests_api-0.6.6/tests/test_conf.py +46 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/tests/test_helpers.py +23 -1
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/tests/test_requests_api.py +3 -1
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/tests/test_requests_api_method.py +1 -0
- django_requests_api-0.6.6/tox.ini +13 -0
- django_requests_api-0.6.2/CHANGELOG.rst +0 -5
- django_requests_api-0.6.2/PKG-INFO +0 -130
- django_requests_api-0.6.2/README.md +0 -87
- django_requests_api-0.6.2/mkdocs.yml +0 -70
- django_requests_api-0.6.2/pyproject.toml +0 -65
- django_requests_api-0.6.2/requirements/py310-django32.txt +0 -173
- django_requests_api-0.6.2/requirements/py310-django42.txt +0 -169
- django_requests_api-0.6.2/requirements/py310-django52.txt +0 -169
- django_requests_api-0.6.2/requirements/py311-django32.txt +0 -169
- django_requests_api-0.6.2/requirements/py311-django42.txt +0 -165
- django_requests_api-0.6.2/requirements/py311-django52.txt +0 -165
- django_requests_api-0.6.2/requirements/py312-django32.txt +0 -169
- django_requests_api-0.6.2/requirements/py312-django42.txt +0 -165
- django_requests_api-0.6.2/requirements/py312-django52.txt +0 -165
- django_requests_api-0.6.2/requirements/py313-django52.txt +0 -165
- django_requests_api-0.6.2/requirements/py314-django52.txt +0 -165
- django_requests_api-0.6.2/requirements/py38-django32.txt +0 -173
- django_requests_api-0.6.2/requirements/py38-django42.txt +0 -187
- django_requests_api-0.6.2/requirements/py39-django32.txt +0 -173
- django_requests_api-0.6.2/requirements/py39-django42.txt +0 -169
- django_requests_api-0.6.2/setup.cfg +0 -87
- django_requests_api-0.6.2/setup.py +0 -6
- django_requests_api-0.6.2/src/django_requests_api.egg-info/PKG-INFO +0 -130
- django_requests_api-0.6.2/src/requests_api/helpers.py +0 -52
- django_requests_api-0.6.2/tox.ini +0 -84
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/CONTRIBUTING.md +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/LICENSE +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/MANIFEST.in +0 -0
- /django_requests_api-0.6.2/requirements/requirements.in → /django_requests_api-0.6.6/requirements/runtime.in +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/runtests.py +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/django_requests_api.egg-info/dependency_links.txt +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/django_requests_api.egg-info/not-zip-safe +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/django_requests_api.egg-info/top_level.txt +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/src/requests_api/apps.py +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/tests/__init__.py +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/tests/settings.py +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/tests/urls.py +0 -0
- {django_requests_api-0.6.2 → django_requests_api-0.6.6}/tests/views.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
repos:
|
|
2
2
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
-
rev:
|
|
3
|
+
rev: v6.0.0
|
|
4
4
|
hooks:
|
|
5
5
|
- id: check-added-large-files
|
|
6
6
|
- id: check-case-conflict
|
|
@@ -11,37 +11,42 @@ repos:
|
|
|
11
11
|
- id: end-of-file-fixer
|
|
12
12
|
- id: trailing-whitespace
|
|
13
13
|
- repo: https://github.com/asottile/pyupgrade
|
|
14
|
-
rev: v3.
|
|
14
|
+
rev: v3.21.2
|
|
15
15
|
hooks:
|
|
16
16
|
- id: pyupgrade
|
|
17
17
|
args: [--py36-plus]
|
|
18
|
-
- repo: https://github.com/psf/black
|
|
19
|
-
rev:
|
|
18
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
19
|
+
rev: 26.3.1
|
|
20
20
|
hooks:
|
|
21
21
|
- id: black
|
|
22
22
|
- repo: https://github.com/asottile/blacken-docs
|
|
23
|
-
rev: 1.
|
|
23
|
+
rev: 1.20.0
|
|
24
24
|
hooks:
|
|
25
25
|
- id: blacken-docs
|
|
26
26
|
additional_dependencies:
|
|
27
27
|
- black>=22.12.0
|
|
28
28
|
- repo: https://github.com/pycqa/isort
|
|
29
|
-
rev:
|
|
29
|
+
rev: 8.0.1
|
|
30
30
|
hooks:
|
|
31
31
|
- id: isort
|
|
32
32
|
args: ["--profile", "black"]
|
|
33
33
|
- repo: https://github.com/PyCQA/flake8
|
|
34
|
-
rev:
|
|
34
|
+
rev: 7.3.0
|
|
35
35
|
hooks:
|
|
36
36
|
- id: flake8
|
|
37
37
|
additional_dependencies:
|
|
38
|
+
- flake8-pyproject
|
|
38
39
|
- flake8-bugbear
|
|
39
40
|
- flake8-comprehensions
|
|
40
41
|
- flake8-tidy-imports
|
|
41
42
|
- flake8-typing-imports
|
|
42
43
|
- repo: https://github.com/mgedmin/check-manifest
|
|
43
|
-
rev: "0.
|
|
44
|
+
rev: "0.51"
|
|
44
45
|
hooks:
|
|
45
46
|
- id: check-manifest
|
|
46
47
|
args: [--no-build-isolation]
|
|
47
|
-
additional_dependencies:
|
|
48
|
+
additional_dependencies:
|
|
49
|
+
- Django>=3.2
|
|
50
|
+
- build
|
|
51
|
+
- setuptools>=77
|
|
52
|
+
- wheel
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
requests_api 0.6.6 (2026-08-13)
|
|
2
|
+
===============================
|
|
3
|
+
|
|
4
|
+
No significant changes.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
requests_api 0.6.5 (2026-08-10)
|
|
8
|
+
===============================
|
|
9
|
+
|
|
10
|
+
No significant changes.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
requests_api 0.2.0-dev (2023-06-23)
|
|
14
|
+
====================================
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
No significant changes.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# Require review from Code Owners
|
|
2
|
-
* @dlrsp-dev
|
|
2
|
+
* @dlrsp-dev @dlrsp-actions[bot]
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-requests-api
|
|
3
|
+
Version: 0.6.6
|
|
4
|
+
Summary: Django application providing a thin requests.Session wrapper with a base URL and small HTTP helpers.
|
|
5
|
+
Author-email: DLRSP <dlrsp.dev@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DLRSP/django-requests-api
|
|
8
|
+
Project-URL: Documentation, https://github.com/DLRSP/django-requests-api/
|
|
9
|
+
Project-URL: Repository, https://github.com/DLRSP/django-requests-api
|
|
10
|
+
Project-URL: Issues, https://github.com/DLRSP/django-requests-api/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/DLRSP/django-requests-api/blob/main/CHANGELOG.rst
|
|
12
|
+
Keywords: django,requests,http,api
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Framework :: Django
|
|
17
|
+
Classifier: Framework :: Django :: 3.2
|
|
18
|
+
Classifier: Framework :: Django :: 4.2
|
|
19
|
+
Classifier: Framework :: Django :: 5.2
|
|
20
|
+
Classifier: Intended Audience :: Developers
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python
|
|
23
|
+
Classifier: Programming Language :: Python :: 3
|
|
24
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
30
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
31
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
32
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
|
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
34
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
35
|
+
Requires-Python: >=3.10
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
License-File: LICENSE
|
|
38
|
+
Requires-Dist: Django>=3.2
|
|
39
|
+
Requires-Dist: requests>=2.32.5
|
|
40
|
+
Provides-Extra: testing
|
|
41
|
+
Requires-Dist: coverage; extra == "testing"
|
|
42
|
+
Requires-Dist: codecov; extra == "testing"
|
|
43
|
+
Provides-Extra: linting
|
|
44
|
+
Requires-Dist: flake8; extra == "linting"
|
|
45
|
+
Requires-Dist: Flake8-pyproject; extra == "linting"
|
|
46
|
+
Requires-Dist: pylint; extra == "linting"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
# django-requests-api [](https://pypi.python.org/pypi/django-requests-api)
|
|
50
|
+
|
|
51
|
+
[](https://pypi.python.org/pypi/django-requests-api)
|
|
52
|
+
[](https://pypi.python.org/pypi/django-requests-api)
|
|
53
|
+
[](https://pypi.python.org/pypi/django-requests-api)
|
|
54
|
+
[](https://codecov.io/github/DLRSP/django-requests-api?branch=master)
|
|
55
|
+
[](https://results.pre-commit.ci/latest/github/DLRSP/django-requests-api/master)
|
|
56
|
+
[](https://github.com/DLRSP/django-requests-api/actions/workflows/ci.yaml)
|
|
57
|
+
|
|
58
|
+
## Demo
|
|
59
|
+
|
|
60
|
+
- [Heroku demo](https://django-requests-api.herokuapp.com/) (if still online)
|
|
61
|
+
- [Example branch](https://github.com/DLRSP/example/tree/django-requests-api) on DLRSP/example
|
|
62
|
+
|
|
63
|
+
## Requirements
|
|
64
|
+
|
|
65
|
+
- Python 3.9+
|
|
66
|
+
- Django 4.2+ (see package classifiers for the full matrix)
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
pip install django-requests-api
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
INSTALLED_APPS = (
|
|
76
|
+
# ...
|
|
77
|
+
"requests_api",
|
|
78
|
+
# ...
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Usage
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from requests_api import RequestsApi
|
|
86
|
+
|
|
87
|
+
client = RequestsApi("https://api.publicapis.org")
|
|
88
|
+
r = client.get("/entries")
|
|
89
|
+
print(r.json())
|
|
90
|
+
|
|
91
|
+
github = RequestsApi(
|
|
92
|
+
"https://api.github.com",
|
|
93
|
+
headers={"Authorization": "token abcdef"},
|
|
94
|
+
)
|
|
95
|
+
r = github.get("/user", headers={"Accept": "application/json"})
|
|
96
|
+
print(r.text)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Paths are joined to `base_url` with a single slash. Absolute URLs (`http://` / `https://`) are passed through unchanged. The package depends on **requests** (`install_requires`).
|
|
100
|
+
|
|
101
|
+
### Helpers
|
|
102
|
+
|
|
103
|
+
Implementation: `requests_api.requests_api` and `requests_api.helpers`; public imports from the package root:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from requests_api import (
|
|
107
|
+
copy_get_params_with_overrides,
|
|
108
|
+
normalize_api_language,
|
|
109
|
+
requests_api_for_base,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
lang = normalize_api_language(
|
|
113
|
+
request.LANGUAGE_CODE,
|
|
114
|
+
allowed=("it", "en"),
|
|
115
|
+
fallback="en",
|
|
116
|
+
)
|
|
117
|
+
params = copy_get_params_with_overrides(request, lang=lang)
|
|
118
|
+
client = requests_api_for_base("https://www.example.com")
|
|
119
|
+
r = client.get("api/resource", params=params, timeout=30)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Configuration (`APP_CONFIG` / `REQUESTS_API_*`)
|
|
123
|
+
|
|
124
|
+
Read via **`requests_api.conf`**: Django settings first, then **`APP_CONFIG["requests_api"]`**, then defaults.
|
|
125
|
+
|
|
126
|
+
| `APP_CONFIG["requests_api"]` | Django setting | Notes |
|
|
127
|
+
|------------------------------|----------------|--------|
|
|
128
|
+
| `CACHED_CLIENTS_MAXSIZE` | `REQUESTS_API_CACHED_CLIENTS_MAXSIZE` | Cap for `requests_api_for_base` (default `8`). `0` or below turns caching off. |
|
|
129
|
+
| `DEFAULT_REQUEST_TIMEOUT` | `REQUESTS_API_DEFAULT_REQUEST_TIMEOUT` | Optional seconds; default `None`. Not applied automatically—call `get_requests_api_default_request_timeout()` and pass `timeout=` yourself if you want a shared value. |
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from requests_api import get_requests_api_default_request_timeout
|
|
133
|
+
|
|
134
|
+
timeout = get_requests_api_default_request_timeout()
|
|
135
|
+
client = requests_api_for_base("https://api.example.com")
|
|
136
|
+
r = client.get("v1/x", timeout=timeout if timeout is not None else 30)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
In tests, call **`clear_requests_api_client_cache()`** when you change cache settings. Full write-up: `docs/tutorial/configuration.md` (MkDocs: *Tutorials → Configuration*).
|
|
140
|
+
|
|
141
|
+
## Run the example locally
|
|
142
|
+
|
|
143
|
+
```shell
|
|
144
|
+
git clone --depth=50 --branch=django-requests-api https://github.com/DLRSP/example.git example-requests-api
|
|
145
|
+
cd example-requests-api
|
|
146
|
+
python manage.py runserver
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Then open http://127.0.0.1:8000 (install dependencies from that repo’s `requirements/` first).
|
|
150
|
+
|
|
151
|
+
## Docs
|
|
152
|
+
|
|
153
|
+
MkDocs sources live under `docs/`. See [Contributing](docs/community/contributing.md) for `mkdocs serve`.
|
|
154
|
+
|
|
155
|
+
- [References & ecosystem](docs/community/references.md)
|
|
156
|
+
- [HTTP status codes (quick reference)](docs/community/http-status-codes.md)
|
|
157
|
+
|
|
158
|
+
## Used in
|
|
159
|
+
|
|
160
|
+
Public GitHub projects that reference **django-requests-api** / `requests_api` (weekly sync via [`.github/used-in.yaml`](.github/used-in.yaml) and [`update-used-in`](https://github.com/DLRSP/workflows/blob/main/.github/workflows/update-used-in.yaml)):
|
|
161
|
+
|
|
162
|
+
<!-- used-in:auto-start -->
|
|
163
|
+
-  [django-iubenda](https://github.com/DLRSP/django-iubenda#readme) — Django application for privacy and cookies policy managed by Iubenda.
|
|
164
|
+
<!-- used-in:auto-end -->
|
|
165
|
+
|
|
166
|
+
Missing a project? Open a PR or run the workflow manually in your fork.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# django-requests-api [](https://pypi.python.org/pypi/django-requests-api)
|
|
2
|
+
|
|
3
|
+
[](https://pypi.python.org/pypi/django-requests-api)
|
|
4
|
+
[](https://pypi.python.org/pypi/django-requests-api)
|
|
5
|
+
[](https://pypi.python.org/pypi/django-requests-api)
|
|
6
|
+
[](https://codecov.io/github/DLRSP/django-requests-api?branch=master)
|
|
7
|
+
[](https://results.pre-commit.ci/latest/github/DLRSP/django-requests-api/master)
|
|
8
|
+
[](https://github.com/DLRSP/django-requests-api/actions/workflows/ci.yaml)
|
|
9
|
+
|
|
10
|
+
## Demo
|
|
11
|
+
|
|
12
|
+
- [Heroku demo](https://django-requests-api.herokuapp.com/) (if still online)
|
|
13
|
+
- [Example branch](https://github.com/DLRSP/example/tree/django-requests-api) on DLRSP/example
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Python 3.9+
|
|
18
|
+
- Django 4.2+ (see package classifiers for the full matrix)
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```shell
|
|
23
|
+
pip install django-requests-api
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
INSTALLED_APPS = (
|
|
28
|
+
# ...
|
|
29
|
+
"requests_api",
|
|
30
|
+
# ...
|
|
31
|
+
)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from requests_api import RequestsApi
|
|
38
|
+
|
|
39
|
+
client = RequestsApi("https://api.publicapis.org")
|
|
40
|
+
r = client.get("/entries")
|
|
41
|
+
print(r.json())
|
|
42
|
+
|
|
43
|
+
github = RequestsApi(
|
|
44
|
+
"https://api.github.com",
|
|
45
|
+
headers={"Authorization": "token abcdef"},
|
|
46
|
+
)
|
|
47
|
+
r = github.get("/user", headers={"Accept": "application/json"})
|
|
48
|
+
print(r.text)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Paths are joined to `base_url` with a single slash. Absolute URLs (`http://` / `https://`) are passed through unchanged. The package depends on **requests** (`install_requires`).
|
|
52
|
+
|
|
53
|
+
### Helpers
|
|
54
|
+
|
|
55
|
+
Implementation: `requests_api.requests_api` and `requests_api.helpers`; public imports from the package root:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from requests_api import (
|
|
59
|
+
copy_get_params_with_overrides,
|
|
60
|
+
normalize_api_language,
|
|
61
|
+
requests_api_for_base,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
lang = normalize_api_language(
|
|
65
|
+
request.LANGUAGE_CODE,
|
|
66
|
+
allowed=("it", "en"),
|
|
67
|
+
fallback="en",
|
|
68
|
+
)
|
|
69
|
+
params = copy_get_params_with_overrides(request, lang=lang)
|
|
70
|
+
client = requests_api_for_base("https://www.example.com")
|
|
71
|
+
r = client.get("api/resource", params=params, timeout=30)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Configuration (`APP_CONFIG` / `REQUESTS_API_*`)
|
|
75
|
+
|
|
76
|
+
Read via **`requests_api.conf`**: Django settings first, then **`APP_CONFIG["requests_api"]`**, then defaults.
|
|
77
|
+
|
|
78
|
+
| `APP_CONFIG["requests_api"]` | Django setting | Notes |
|
|
79
|
+
|------------------------------|----------------|--------|
|
|
80
|
+
| `CACHED_CLIENTS_MAXSIZE` | `REQUESTS_API_CACHED_CLIENTS_MAXSIZE` | Cap for `requests_api_for_base` (default `8`). `0` or below turns caching off. |
|
|
81
|
+
| `DEFAULT_REQUEST_TIMEOUT` | `REQUESTS_API_DEFAULT_REQUEST_TIMEOUT` | Optional seconds; default `None`. Not applied automatically—call `get_requests_api_default_request_timeout()` and pass `timeout=` yourself if you want a shared value. |
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from requests_api import get_requests_api_default_request_timeout
|
|
85
|
+
|
|
86
|
+
timeout = get_requests_api_default_request_timeout()
|
|
87
|
+
client = requests_api_for_base("https://api.example.com")
|
|
88
|
+
r = client.get("v1/x", timeout=timeout if timeout is not None else 30)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
In tests, call **`clear_requests_api_client_cache()`** when you change cache settings. Full write-up: `docs/tutorial/configuration.md` (MkDocs: *Tutorials → Configuration*).
|
|
92
|
+
|
|
93
|
+
## Run the example locally
|
|
94
|
+
|
|
95
|
+
```shell
|
|
96
|
+
git clone --depth=50 --branch=django-requests-api https://github.com/DLRSP/example.git example-requests-api
|
|
97
|
+
cd example-requests-api
|
|
98
|
+
python manage.py runserver
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then open http://127.0.0.1:8000 (install dependencies from that repo’s `requirements/` first).
|
|
102
|
+
|
|
103
|
+
## Docs
|
|
104
|
+
|
|
105
|
+
MkDocs sources live under `docs/`. See [Contributing](docs/community/contributing.md) for `mkdocs serve`.
|
|
106
|
+
|
|
107
|
+
- [References & ecosystem](docs/community/references.md)
|
|
108
|
+
- [HTTP status codes (quick reference)](docs/community/http-status-codes.md)
|
|
109
|
+
|
|
110
|
+
## Used in
|
|
111
|
+
|
|
112
|
+
Public GitHub projects that reference **django-requests-api** / `requests_api` (weekly sync via [`.github/used-in.yaml`](.github/used-in.yaml) and [`update-used-in`](https://github.com/DLRSP/workflows/blob/main/.github/workflows/update-used-in.yaml)):
|
|
113
|
+
|
|
114
|
+
<!-- used-in:auto-start -->
|
|
115
|
+
-  [django-iubenda](https://github.com/DLRSP/django-iubenda#readme) — Django application for privacy and cookies policy managed by Iubenda.
|
|
116
|
+
<!-- used-in:auto-end -->
|
|
117
|
+
|
|
118
|
+
Missing a project? Open a PR or run the workflow manually in your fork.
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
site_name: django-requests-api
|
|
2
|
+
site_url: https://github.com/DLRSP/django-requests-api/
|
|
3
|
+
site_description: Thin requests.Session wrapper and helpers for Django projects.
|
|
4
|
+
|
|
5
|
+
repo_name: DLRSP/django-requests-api
|
|
6
|
+
repo_url: https://github.com/DLRSP/django-requests-api/
|
|
7
|
+
|
|
8
|
+
theme:
|
|
9
|
+
name: material
|
|
10
|
+
palette:
|
|
11
|
+
- scheme: default
|
|
12
|
+
toggle:
|
|
13
|
+
icon: material/weather-sunny
|
|
14
|
+
name: Switch to dark mode
|
|
15
|
+
- scheme: slate
|
|
16
|
+
toggle:
|
|
17
|
+
icon: material/weather-night
|
|
18
|
+
name: Switch to light mode
|
|
19
|
+
features:
|
|
20
|
+
- navigation.instant
|
|
21
|
+
- navigation.top
|
|
22
|
+
- content.code.annotate
|
|
23
|
+
- content.tabs.link
|
|
24
|
+
- search.suggest
|
|
25
|
+
- search.highlight
|
|
26
|
+
icon:
|
|
27
|
+
repo: fontawesome/brands/github-alt
|
|
28
|
+
|
|
29
|
+
plugins:
|
|
30
|
+
- search
|
|
31
|
+
- git-revision-date
|
|
32
|
+
|
|
33
|
+
extra:
|
|
34
|
+
analytics:
|
|
35
|
+
provider: google
|
|
36
|
+
property: G-7VL775RPH9
|
|
37
|
+
social:
|
|
38
|
+
- icon: fontawesome/brands/twitter
|
|
39
|
+
link: https://twitter.com/DlrspTwits
|
|
40
|
+
name: DLRSP on Twitter
|
|
41
|
+
- icon: fontawesome/solid/paper-plane
|
|
42
|
+
link: mailto:dlrsp.dev@gmail.com
|
|
43
|
+
- icon: fontawesome/brands/github
|
|
44
|
+
link: https://github.com/DLRSP
|
|
45
|
+
|
|
46
|
+
markdown_extensions:
|
|
47
|
+
- toc:
|
|
48
|
+
anchorlink: true
|
|
49
|
+
- pymdownx.tabbed:
|
|
50
|
+
alternate_style: true
|
|
51
|
+
- pymdownx.highlight:
|
|
52
|
+
- pymdownx.inlinehilite:
|
|
53
|
+
- pymdownx.superfences:
|
|
54
|
+
- pymdownx.snippets:
|
|
55
|
+
|
|
56
|
+
nav:
|
|
57
|
+
- Home: index.md
|
|
58
|
+
- Tutorials:
|
|
59
|
+
- Example project: tutorial/example.md
|
|
60
|
+
- Configuration: tutorial/configuration.md
|
|
61
|
+
- Community:
|
|
62
|
+
- References: community/references.md
|
|
63
|
+
- HTTP status codes: community/http-status-codes.md
|
|
64
|
+
- Contributing: community/contributing.md
|
|
65
|
+
|
|
66
|
+
copyright: Copyright © 2010-present DLRSP
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools >= 77",
|
|
4
|
+
"wheel",
|
|
5
|
+
]
|
|
6
|
+
build-backend = "setuptools.build_meta"
|
|
7
|
+
[project]
|
|
8
|
+
name = "django-requests-api"
|
|
9
|
+
description = "Django application providing a thin requests.Session wrapper with a base URL and small HTTP helpers."
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "DLRSP", email = "dlrsp.dev@gmail.com" },
|
|
12
|
+
]
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
dynamic = [
|
|
15
|
+
"version",
|
|
16
|
+
]
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
license = "MIT"
|
|
19
|
+
license-files = [
|
|
20
|
+
"LICENSE",
|
|
21
|
+
]
|
|
22
|
+
keywords = [
|
|
23
|
+
"django",
|
|
24
|
+
"requests",
|
|
25
|
+
"http",
|
|
26
|
+
"api",
|
|
27
|
+
]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Development Status :: 5 - Production/Stable",
|
|
30
|
+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
31
|
+
"Environment :: Web Environment",
|
|
32
|
+
"Framework :: Django",
|
|
33
|
+
"Framework :: Django :: 3.2",
|
|
34
|
+
"Framework :: Django :: 4.2",
|
|
35
|
+
"Framework :: Django :: 5.2",
|
|
36
|
+
"Intended Audience :: Developers",
|
|
37
|
+
"Operating System :: OS Independent",
|
|
38
|
+
"Programming Language :: Python",
|
|
39
|
+
"Programming Language :: Python :: 3",
|
|
40
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
41
|
+
"Programming Language :: Python :: 3.10",
|
|
42
|
+
"Programming Language :: Python :: 3.11",
|
|
43
|
+
"Programming Language :: Python :: 3.12",
|
|
44
|
+
"Programming Language :: Python :: 3.13",
|
|
45
|
+
"Programming Language :: Python :: 3.14",
|
|
46
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
47
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
48
|
+
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
|
|
49
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
50
|
+
"Topic :: Software Development :: Libraries",
|
|
51
|
+
]
|
|
52
|
+
dependencies = [
|
|
53
|
+
"Django>=3.2",
|
|
54
|
+
"requests>=2.32.5",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.urls]
|
|
58
|
+
Homepage = "https://github.com/DLRSP/django-requests-api"
|
|
59
|
+
Documentation = "https://github.com/DLRSP/django-requests-api/"
|
|
60
|
+
Repository = "https://github.com/DLRSP/django-requests-api"
|
|
61
|
+
Issues = "https://github.com/DLRSP/django-requests-api/issues"
|
|
62
|
+
Changelog = "https://github.com/DLRSP/django-requests-api/blob/main/CHANGELOG.rst"
|
|
63
|
+
|
|
64
|
+
[project.optional-dependencies]
|
|
65
|
+
testing = [
|
|
66
|
+
"coverage",
|
|
67
|
+
"codecov",
|
|
68
|
+
]
|
|
69
|
+
linting = [
|
|
70
|
+
"flake8",
|
|
71
|
+
"Flake8-pyproject",
|
|
72
|
+
"pylint",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.setuptools]
|
|
76
|
+
include-package-data = true
|
|
77
|
+
zip-safe = false
|
|
78
|
+
|
|
79
|
+
[tool.setuptools.package-dir]
|
|
80
|
+
"" = "src"
|
|
81
|
+
|
|
82
|
+
[tool.setuptools.dynamic.version]
|
|
83
|
+
attr = "requests_api.__version__"
|
|
84
|
+
|
|
85
|
+
[tool.setuptools.packages.find]
|
|
86
|
+
where = [
|
|
87
|
+
"src",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
[tool.setuptools.data-files]
|
|
92
|
+
"share/django-requests-api/requirements" = [
|
|
93
|
+
"requirements/py310-django42.txt",
|
|
94
|
+
"requirements/py310-django52.txt",
|
|
95
|
+
"requirements/py311-django42.txt",
|
|
96
|
+
"requirements/py311-django52.txt",
|
|
97
|
+
"requirements/py312-django42.txt",
|
|
98
|
+
"requirements/py312-django52.txt",
|
|
99
|
+
"requirements/py313-django52.txt",
|
|
100
|
+
"requirements/py314-django52.txt",
|
|
101
|
+
]
|
|
102
|
+
[tool.distutils.bdist_wheel]
|
|
103
|
+
universal = false
|
|
104
|
+
|
|
105
|
+
[tool.black]
|
|
106
|
+
line-length = 80
|
|
107
|
+
target-version = ['py311']
|
|
108
|
+
[tool.isort]
|
|
109
|
+
profile = "black"
|
|
110
|
+
|
|
111
|
+
[tool.check-manifest]
|
|
112
|
+
ignore = [
|
|
113
|
+
"AGENTS.md",
|
|
114
|
+
"docs/community/third-party-packages.md",
|
|
115
|
+
"docs/tutorial/customize.md",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
# Read by flake8 when flake8-pyproject is installed (extra `linting`).
|
|
119
|
+
[tool.flake8]
|
|
120
|
+
max-line-length = 80
|
|
121
|
+
select = ["E", "F", "W", "B", "B950", "C", "I", "TYP"]
|
|
122
|
+
ignore = ["E203", "E501", "W503", "B950"]
|
|
123
|
+
per-file-ignores = [
|
|
124
|
+
"**/migrations/*:B950",
|
|
125
|
+
]
|
|
126
|
+
[tool.mypy]
|
|
127
|
+
check_untyped_defs = true
|
|
128
|
+
disallow_any_generics = true
|
|
129
|
+
disallow_incomplete_defs = true
|
|
130
|
+
disallow_untyped_defs = true
|
|
131
|
+
mypy_path = "src/"
|
|
132
|
+
no_implicit_optional = true
|
|
133
|
+
show_error_codes = true
|
|
134
|
+
warn_unreachable = true
|
|
135
|
+
warn_unused_ignores = true
|
|
136
|
+
overrides = [
|
|
137
|
+
{ module = "tests.*", allow_untyped_defs = true },
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
[tool.pytest.ini_options]
|
|
141
|
+
addopts = "--strict-config\n --strict-markers\n --ds=tests.settings\n "
|
|
142
|
+
django_find_project = false
|
|
143
|
+
|
|
144
|
+
[tool.coverage.paths]
|
|
145
|
+
source = [
|
|
146
|
+
"src",
|
|
147
|
+
".tox/*/site-packages",
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
[tool.coverage.run]
|
|
151
|
+
branch = true
|
|
152
|
+
source = [
|
|
153
|
+
"requests_api",
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
[tool.coverage.report]
|
|
157
|
+
show_missing = true
|
|
158
|
+
|
|
159
|
+
[tool.towncrier]
|
|
160
|
+
package = "requests_api"
|
|
161
|
+
package_dir = "src"
|
|
162
|
+
filename = "CHANGELOG.rst"
|
|
163
|
+
directory = "news/"
|
|
164
|
+
version = "0.6.6"
|
|
165
|
+
issue_format = "`#{issue} <https://github.com/DLRSP/django-requests-api/issues/{issue}>`_"
|
|
166
|
+
type = [
|
|
167
|
+
{ name = "Process", directory = "process", showcontent = true },
|
|
168
|
+
{ name = "Deprecations and Removals", directory = "removal", showcontent = true },
|
|
169
|
+
{ name = "Features", directory = "feature", showcontent = true },
|
|
170
|
+
{ name = "Bug Fixes", directory = "bugfix", showcontent = true },
|
|
171
|
+
{ name = "Vendored Libraries", directory = "vendor", showcontent = true },
|
|
172
|
+
{ name = "Improved Documentation", directory = "doc", showcontent = true },
|
|
173
|
+
{ name = "Trivial Changes", directory = "trivial", showcontent = false },
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[tool.bumpversion]
|
|
177
|
+
current_version = "0.6.6"
|
|
178
|
+
allow_dirty = true
|
|
179
|
+
files = [
|
|
180
|
+
{ filename = "./src/requests_api/__init__.py" },
|
|
181
|
+
{ filename = "pyproject.toml", search = 'version = "{current_version}"', replace = 'version = "{new_version}"' },
|
|
182
|
+
]
|