django-esi 8.0.0a4__tar.gz → 8.0.0b1__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.
Potentially problematic release.
This version of django-esi might be problematic. Click here for more details.
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/PKG-INFO +3 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/__init__.py +1 -1
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/aiopenapi3/plugins.py +89 -3
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/clients.py +15 -6
- django_esi-8.0.0b1/esi/helpers.py +62 -0
- {django_esi-8.0.0a4/esi/locale/pl_PL → django_esi-8.0.0b1/esi/locale/cs_CZ}/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/de/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/en/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/es/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/fr_FR/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/it_IT/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/ja/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/ko_KR/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4/esi/locale/cs_CZ → django_esi-8.0.0b1/esi/locale/nl_NL}/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4/esi/locale/nl_NL → django_esi-8.0.0b1/esi/locale/pl_PL}/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/ru/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/sk/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/uk/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/zh_Hans/LC_MESSAGES/django.po +2 -2
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/openapi_clients.py +52 -16
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/stubs.pyi +9 -9
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/__init__.py +3 -3
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_clients.py +77 -19
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_openapi.py +162 -8
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/pyproject.toml +2 -1
- django_esi-8.0.0a4/esi/helpers.py +0 -25
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/LICENSE +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/README.md +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/admin.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/app_settings.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/apps.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/checks.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/decorators.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/errors.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/exceptions.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/de/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/en/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/es/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/it_IT/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/ja/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/ru/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/sk/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/uk/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/management/commands/__init__.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/management/commands/generate_esi_stubs.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/management/commands/migrate_to_ssov2.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/managers.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/managers.pyi +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0001_initial.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0002_scopes_20161208.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0003_hide_tokens_from_admin_site.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0004_remove_unique_access_token.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0005_remove_token_length_limit.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0006_remove_url_length_limit.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0007_fix_mysql_8_migration.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0008_nullable_refresh_token.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0009_set_old_tokens_to_sso_v1.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0010_set_new_tokens_to_sso_v2.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0011_add_token_indices.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0012_fix_token_type_choices.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/0013_squashed_0012_fix_token_type_choices.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/migrations/__init__.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/models.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/rate_limiting.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/static/esi/img/EVE_SSO_Login_Buttons_Large_Black.png +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/static/esi/img/EVE_SSO_Login_Buttons_Large_White.png +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/static/esi/img/EVE_SSO_Login_Buttons_Small_Black.png +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/static/esi/img/EVE_SSO_Login_Buttons_Small_White.png +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/stubs.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tasks.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/templates/esi/select_token.html +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/templatetags/__init__.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/templatetags/scope_tags.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/client_authed_pilot.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/client_public_pilot.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/factories.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/factories_2.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/jwt_factory.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_checks.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_decorators.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_management_command.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_managers.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_models.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_openapi.json +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_swagger.json +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_swagger_full.json +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_tasks.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_templatetags.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/test_views.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/tests/threading_pilot.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/urls.py +0 -0
- {django_esi-8.0.0a4 → django_esi-8.0.0b1}/esi/views.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-esi
|
|
3
|
-
Version: 8.0.
|
|
3
|
+
Version: 8.0.0b1
|
|
4
4
|
Summary: Django app for accessing the EVE Swagger Interface (ESI).
|
|
5
5
|
Keywords: eveonline
|
|
6
6
|
Author-email: Alliance Auth <adarnof@gmail.com>
|
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
24
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
24
25
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
25
26
|
License-File: LICENSE
|
|
@@ -27,7 +28,7 @@ Requires-Dist: aiopenapi3
|
|
|
27
28
|
Requires-Dist: bravado>=10.6,<12
|
|
28
29
|
Requires-Dist: celery>=4.0.2
|
|
29
30
|
Requires-Dist: django>=4.2,<6
|
|
30
|
-
Requires-Dist: httpx[
|
|
31
|
+
Requires-Dist: httpx[brotli, http2, zstd]
|
|
31
32
|
Requires-Dist: jsonschema<4
|
|
32
33
|
Requires-Dist: python-jose>=3.3
|
|
33
34
|
Requires-Dist: requests>=2.26
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Any
|
|
3
|
+
from collections.abc import Generator
|
|
1
4
|
from aiopenapi3.plugin import Document, Init
|
|
2
5
|
|
|
6
|
+
logger = logging.getLogger(__name__)
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
class Trim204ContentType(Document):
|
|
4
10
|
"""
|
|
5
11
|
Removes and content-type from responses on a 204 reponses
|
|
6
12
|
A 204 never has content...
|
|
7
13
|
"""
|
|
14
|
+
|
|
8
15
|
def parsed(self, ctx: Document.Context) -> Document.Context:
|
|
9
16
|
spec = ctx.document
|
|
10
17
|
# Patch all paths
|
|
@@ -18,12 +25,88 @@ class Trim204ContentType(Document):
|
|
|
18
25
|
return ctx
|
|
19
26
|
|
|
20
27
|
|
|
28
|
+
def find_refs_recursively(data: Any, parent: Any = None) -> Generator[Any, None, None]:
|
|
29
|
+
"""
|
|
30
|
+
Recursively searches for all instances of "#ref" in a dict+children and returns schemas.
|
|
31
|
+
"""
|
|
32
|
+
if isinstance(data, dict):
|
|
33
|
+
for key, value in data.items():
|
|
34
|
+
if key == "$ref":
|
|
35
|
+
if "#/components/schemas/" in value:
|
|
36
|
+
next = value.split("/")[-1]
|
|
37
|
+
yield next
|
|
38
|
+
if parent:
|
|
39
|
+
yield from find_refs_recursively(parent[next], parent)
|
|
40
|
+
yield from find_refs_recursively(value, parent)
|
|
41
|
+
elif isinstance(data, list):
|
|
42
|
+
for item in data:
|
|
43
|
+
yield from find_refs_recursively(item, parent)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class MinifySpec(Document):
|
|
47
|
+
"""
|
|
48
|
+
Removes operations and schemas from spec to limit memory spam
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
def __init__(self, tags: list[str], operations: list[str]):
|
|
52
|
+
super().__init__()
|
|
53
|
+
self.keep_tags = set(tags)
|
|
54
|
+
self.keep_ops = operations
|
|
55
|
+
|
|
56
|
+
def parsed(self, ctx: Document.Context) -> Document.Context:
|
|
57
|
+
if self.keep_tags == set() and self.keep_ops == []:
|
|
58
|
+
logger.error("No tag/path filtering supplied to ESI Client. Using all tags. This will bloat memory use!")
|
|
59
|
+
return ctx
|
|
60
|
+
spec = ctx.document
|
|
61
|
+
|
|
62
|
+
remove_paths = set()
|
|
63
|
+
keep_schema = set()
|
|
64
|
+
logger.debug("Filtering Paths/Tags: ")
|
|
65
|
+
for name, path_item in spec.get("paths", {}).items():
|
|
66
|
+
keep = False
|
|
67
|
+
for method_name in ("get", "post", "put", "delete", "patch", "options", "head"):
|
|
68
|
+
method = path_item.get(method_name)
|
|
69
|
+
if not method:
|
|
70
|
+
continue
|
|
71
|
+
if len(self.keep_tags.intersection(method['tags'])) or method["operationId"] in self.keep_ops:
|
|
72
|
+
keep = True
|
|
73
|
+
schemas = find_refs_recursively(
|
|
74
|
+
path_item,
|
|
75
|
+
spec["components"]["schemas"] # find all sub schema's
|
|
76
|
+
)
|
|
77
|
+
for s in schemas:
|
|
78
|
+
keep_schema.add(s)
|
|
79
|
+
|
|
80
|
+
if not keep:
|
|
81
|
+
remove_paths.add(name)
|
|
82
|
+
else:
|
|
83
|
+
logger.debug(f" - {name}")
|
|
84
|
+
|
|
85
|
+
# remove the paths we don't care for
|
|
86
|
+
for name in remove_paths:
|
|
87
|
+
spec["paths"].pop(name)
|
|
88
|
+
|
|
89
|
+
# build new schema from what we need
|
|
90
|
+
logger.debug("Rebuilding Schema: ")
|
|
91
|
+
new_schema = {}
|
|
92
|
+
for name, data in spec["components"]["schemas"].items():
|
|
93
|
+
if name in keep_schema:
|
|
94
|
+
logger.debug(f" - {name}")
|
|
95
|
+
new_schema[name] = data
|
|
96
|
+
|
|
97
|
+
# replace schemas with the new schema
|
|
98
|
+
ctx.document["components"]["schemas"] = new_schema
|
|
99
|
+
|
|
100
|
+
return ctx
|
|
101
|
+
|
|
102
|
+
|
|
21
103
|
class Add304ContentType(Document):
|
|
22
104
|
"""
|
|
23
105
|
Adds 304 content-type to responses
|
|
24
106
|
A 304 never has content. ESI defualt has application/json
|
|
25
107
|
This is a hack for now
|
|
26
108
|
"""
|
|
109
|
+
|
|
27
110
|
def parsed(self, ctx: Document.Context) -> Document.Context:
|
|
28
111
|
spec = ctx.document
|
|
29
112
|
# Patch all paths
|
|
@@ -33,7 +116,7 @@ class Add304ContentType(Document):
|
|
|
33
116
|
if not method:
|
|
34
117
|
continue
|
|
35
118
|
if "304" not in method['responses']:
|
|
36
|
-
method['responses']["304"]={
|
|
119
|
+
method['responses']["304"] = {
|
|
37
120
|
"description": "Not Modified"
|
|
38
121
|
}
|
|
39
122
|
return ctx
|
|
@@ -43,6 +126,7 @@ class RemoveSecurityParameter(Document):
|
|
|
43
126
|
"""
|
|
44
127
|
Removes the whole OAuth2 securityScheme
|
|
45
128
|
"""
|
|
129
|
+
|
|
46
130
|
def parsed(self, ctx: Document.Context) -> Document.Context:
|
|
47
131
|
print("RemoveSecurityParameterPlugin: Removing OAuth2 securityScheme")
|
|
48
132
|
spec = ctx.document
|
|
@@ -63,6 +147,7 @@ class TrimSecurityParameter(Document):
|
|
|
63
147
|
Trims out of Spec OAuth2 attributes. CCP have fixed this.
|
|
64
148
|
Leaving in place in case we need a quick reference again.
|
|
65
149
|
"""
|
|
150
|
+
|
|
66
151
|
def parsed(self, ctx: Document.Context) -> Document.Context:
|
|
67
152
|
print("TrimSecurityParameter: Trimming out of spec attributes")
|
|
68
153
|
spec = ctx.document
|
|
@@ -80,8 +165,9 @@ class PatchCompatibilityDatePlugin(Document):
|
|
|
80
165
|
This is because WE specifically add it in the library to the HTTP requests,
|
|
81
166
|
but without this, it will be a required parameter during request generation before it hits the HTTP library.
|
|
82
167
|
"""
|
|
168
|
+
|
|
83
169
|
def parsed(self, ctx: Document.Context) -> Document.Context:
|
|
84
|
-
|
|
170
|
+
logger.debug("PatchCompatibilityDatePlugin: making compatibility date optional")
|
|
85
171
|
spec = ctx.document
|
|
86
172
|
|
|
87
173
|
def patch_param(param):
|
|
@@ -124,5 +210,5 @@ class DjangoESIInit(Init):
|
|
|
124
210
|
|
|
125
211
|
def initialized(self, ctx: Init.Context) -> Init.Context:
|
|
126
212
|
# Force the app_name into the api client class for etags
|
|
127
|
-
self.api.app_name=self.app_name
|
|
213
|
+
self.api.app_name = self.app_name
|
|
128
214
|
return ctx # noqa
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
3
|
import warnings
|
|
4
|
-
|
|
4
|
+
import datetime as dt
|
|
5
5
|
from hashlib import md5
|
|
6
6
|
from time import sleep
|
|
7
7
|
from typing import Any
|
|
@@ -68,8 +68,10 @@ class CachingHttpFuture(HttpFuture):
|
|
|
68
68
|
seconds until "Expires" time
|
|
69
69
|
"""
|
|
70
70
|
try:
|
|
71
|
-
expires_dt = datetime.strptime(str(expires), '%a, %d %b %Y %H:%M:%S %Z')
|
|
72
|
-
|
|
71
|
+
expires_dt = dt.datetime.strptime(str(expires), '%a, %d %b %Y %H:%M:%S %Z')
|
|
72
|
+
if expires_dt.tzinfo is None:
|
|
73
|
+
expires_dt = expires_dt.replace(tzinfo=dt.timezone.utc)
|
|
74
|
+
delta = expires_dt - dt.datetime.now(dt.timezone.utc)
|
|
73
75
|
return delta.total_seconds()
|
|
74
76
|
except ValueError:
|
|
75
77
|
return 0
|
|
@@ -482,19 +484,26 @@ def esi_client_factory(
|
|
|
482
484
|
|
|
483
485
|
client = RequestsClientPlus()
|
|
484
486
|
|
|
487
|
+
from esi.helpers import pascal_case_string
|
|
488
|
+
sanitized_appname = pascal_case_string(__title__)
|
|
489
|
+
|
|
485
490
|
if app_info_text:
|
|
486
491
|
# app_info_text (email@example) Django-ESI/1.2.3 (+https://gitlab.com/allianceauth/django-esi)
|
|
487
492
|
# Deprecated
|
|
488
|
-
user_agent = f"{app_info_text} ({app_settings.ESI_USER_CONTACT_EMAIL}) {
|
|
493
|
+
user_agent = f"{app_info_text} ({app_settings.ESI_USER_CONTACT_EMAIL}) {sanitized_appname}/{__version__} (+{__url__})"
|
|
489
494
|
elif ua_appname is None or ua_version is None:
|
|
490
495
|
# Django-ESI/1.2.3 () (email@example; +https://gitlab.com/allianceauth/django-esi)
|
|
491
496
|
# Deprecated
|
|
492
|
-
user_agent = f"{
|
|
497
|
+
user_agent = f"{sanitized_appname}/{__version__} ({app_settings.ESI_USER_CONTACT_EMAIL}; +{__url__})"
|
|
493
498
|
else:
|
|
494
499
|
# AppName/1.2.3 (email@example.com) Django-ESI/1.2.3 (+https://gitlab.com/allianceauth/django-esi)
|
|
495
500
|
# or AppName/1.2.3 (email@example.com; +https://gitlab.com/) Django-ESI/1.2.3 (+https://gitlab.com/allianceauth/django-esi) (+https://gitlab.com/allianceauth/django-esi)
|
|
496
501
|
# Preferred
|
|
497
|
-
|
|
502
|
+
|
|
503
|
+
# Enforce PascalCase for `ua_appname` and strip whitespace
|
|
504
|
+
sanitized_ua_appname = pascal_case_string(ua_appname)
|
|
505
|
+
|
|
506
|
+
user_agent = f"{sanitized_ua_appname}/{ua_version} ({app_settings.ESI_USER_CONTACT_EMAIL}{f'; +{ua_url})' if ua_url else ')'} {sanitized_appname}/{__version__} (+{__url__})"
|
|
498
507
|
|
|
499
508
|
client.user_agent = user_agent
|
|
500
509
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from esi.models import Token
|
|
2
|
+
from string import capwords
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def get_token(character_id: int, scopes: list) -> Token:
|
|
6
|
+
"""Helper method to get a valid token for a specific character with specific scopes.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
character_id: Character to filter on.
|
|
10
|
+
scopes: array of ESI scope strings to search for.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
Matching Token
|
|
14
|
+
"""
|
|
15
|
+
qs = (
|
|
16
|
+
Token.objects
|
|
17
|
+
.filter(character_id=character_id)
|
|
18
|
+
.require_scopes(scopes)
|
|
19
|
+
.require_valid()
|
|
20
|
+
)
|
|
21
|
+
token = qs.first()
|
|
22
|
+
if token is None:
|
|
23
|
+
raise Token.DoesNotExist(
|
|
24
|
+
f"No valid token found for character_id={character_id} with required scopes."
|
|
25
|
+
)
|
|
26
|
+
return token
|
|
27
|
+
|
|
28
|
+
def pascal_case_string(string: str) -> str:
|
|
29
|
+
"""
|
|
30
|
+
Convert a string to PascalCase by capitalizing the first letter of each word and removing spaces,
|
|
31
|
+
but only if the string contains spaces or hyphens.
|
|
32
|
+
|
|
33
|
+
This function checks if the input string contains spaces or hyphens. If so, it replaces hyphens with spaces,
|
|
34
|
+
capitalizes the first letter of each word, removes the spaces, and returns the resulting PascalCase string.
|
|
35
|
+
If the input string does not contain spaces or hyphens, it is returned unchanged.
|
|
36
|
+
|
|
37
|
+
Behaviour:
|
|
38
|
+
Any string containing spaces or hyphens will be converted to PascalCase.
|
|
39
|
+
Strings without spaces or hyphens will be returned unchanged.
|
|
40
|
+
This gives you the opportunity to use already formatted strings as needed.
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
- "app name" -> "AppName"
|
|
44
|
+
- "app-name" -> "AppName"
|
|
45
|
+
- "appname" -> "appname"
|
|
46
|
+
- "AppName" -> "AppName"
|
|
47
|
+
- "appName" -> "appName"
|
|
48
|
+
- "app_name" -> "app_name"
|
|
49
|
+
|
|
50
|
+
:param string: The input string to be converted to PascalCase.
|
|
51
|
+
:type string: str
|
|
52
|
+
:return: The PascalCase formatted string, or the original string if no spaces or hyphens are present.
|
|
53
|
+
:rtype: str
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
# Check if the string contains spaces or hyphens
|
|
57
|
+
if any(c in string for c in (" ", "-")):
|
|
58
|
+
# Replace hyphens with spaces, capitalize each word, and remove spaces
|
|
59
|
+
return capwords(string.replace("-", " ")).replace(" ", "")
|
|
60
|
+
|
|
61
|
+
# Return the original string if no spaces or hyphens are present
|
|
62
|
+
return string
|
{django_esi-8.0.0a4/esi/locale/pl_PL → django_esi-8.0.0b1/esi/locale/cs_CZ}/LC_MESSAGES/django.po
RENAMED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
#, fuzzy
|
|
7
7
|
msgid ""
|
|
8
8
|
msgstr ""
|
|
9
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
9
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
11
|
-
"POT-Creation-Date: 2025-
|
|
11
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#, fuzzy
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
12
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
14
|
-
"POT-Creation-Date: 2025-
|
|
14
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
15
15
|
"PO-Revision-Date: 2023-10-25 11:04+0000\n"
|
|
16
16
|
"Last-Translator: Peter Pfeufer, 2023\n"
|
|
17
17
|
"Language-Team: German (https://app.transifex.com/alliance-auth/teams/107430/"
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
#, fuzzy
|
|
7
7
|
msgid ""
|
|
8
8
|
msgstr ""
|
|
9
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
9
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
11
|
-
"POT-Creation-Date: 2025-
|
|
11
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#, fuzzy
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
12
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
14
|
-
"POT-Creation-Date: 2025-
|
|
14
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
15
15
|
"PO-Revision-Date: 2023-10-25 11:04+0000\n"
|
|
16
16
|
"Last-Translator: trenus, 2023\n"
|
|
17
17
|
"Language-Team: Spanish (https://app.transifex.com/alliance-auth/teams/107430/"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#, fuzzy
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
12
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
14
|
-
"POT-Creation-Date: 2025-
|
|
14
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
15
15
|
"PO-Revision-Date: 2020-12-28 06:44+0000\n"
|
|
16
16
|
"Last-Translator: rockclodbuster, 2023\n"
|
|
17
17
|
"Language-Team: French (France) (https://app.transifex.com/alliance-auth/"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#, fuzzy
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
12
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
14
|
-
"POT-Creation-Date: 2025-
|
|
14
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
15
15
|
"PO-Revision-Date: 2023-10-25 11:04+0000\n"
|
|
16
16
|
"Last-Translator: Thomas Turini, 2024\n"
|
|
17
17
|
"Language-Team: Italian (Italy) (https://app.transifex.com/alliance-auth/"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#, fuzzy
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
12
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
14
|
-
"POT-Creation-Date: 2025-
|
|
14
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
15
15
|
"PO-Revision-Date: 2023-10-25 11:04+0000\n"
|
|
16
16
|
"Last-Translator: kotaneko, 2023\n"
|
|
17
17
|
"Language-Team: Japanese (https://app.transifex.com/alliance-auth/"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#, fuzzy
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
12
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
14
|
-
"POT-Creation-Date: 2025-
|
|
14
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
15
15
|
"PO-Revision-Date: 2023-10-25 11:04+0000\n"
|
|
16
16
|
"Last-Translator: Seowon Jung <seowon@hawaii.edu>, 2023\n"
|
|
17
17
|
"Language-Team: Korean (Korea) (https://app.transifex.com/alliance-auth/"
|
{django_esi-8.0.0a4/esi/locale/cs_CZ → django_esi-8.0.0b1/esi/locale/nl_NL}/LC_MESSAGES/django.po
RENAMED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
#, fuzzy
|
|
7
7
|
msgid ""
|
|
8
8
|
msgstr ""
|
|
9
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
9
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
11
|
-
"POT-Creation-Date: 2025-
|
|
11
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
{django_esi-8.0.0a4/esi/locale/nl_NL → django_esi-8.0.0b1/esi/locale/pl_PL}/LC_MESSAGES/django.po
RENAMED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
#, fuzzy
|
|
7
7
|
msgid ""
|
|
8
8
|
msgstr ""
|
|
9
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
9
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
11
|
-
"POT-Creation-Date: 2025-
|
|
11
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
#, fuzzy
|
|
11
11
|
msgid ""
|
|
12
12
|
msgstr ""
|
|
13
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
13
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
14
14
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
15
|
-
"POT-Creation-Date: 2025-
|
|
15
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
16
16
|
"PO-Revision-Date: 2023-10-25 11:04+0000\n"
|
|
17
17
|
"Last-Translator: Gnevich <and.vareba81@gmail.com>, 2025\n"
|
|
18
18
|
"Language-Team: Russian (https://app.transifex.com/alliance-auth/teams/107430/"
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
#, fuzzy
|
|
7
7
|
msgid ""
|
|
8
8
|
msgstr ""
|
|
9
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
9
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
11
|
-
"POT-Creation-Date: 2025-
|
|
11
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
#, fuzzy
|
|
7
7
|
msgid ""
|
|
8
8
|
msgstr ""
|
|
9
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
9
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
11
|
-
"POT-Creation-Date: 2025-
|
|
11
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#, fuzzy
|
|
10
10
|
msgid ""
|
|
11
11
|
msgstr ""
|
|
12
|
-
"Project-Id-Version: Django ESI 8.0.0-
|
|
12
|
+
"Project-Id-Version: Django ESI 8.0.0-beta.1\n"
|
|
13
13
|
"Report-Msgid-Bugs-To: https://gitlab.com/allianceauth/django-esi/-/issues\n"
|
|
14
|
-
"POT-Creation-Date: 2025-
|
|
14
|
+
"POT-Creation-Date: 2025-10-17 15:19+1000\n"
|
|
15
15
|
"PO-Revision-Date: 2023-10-25 11:04+0000\n"
|
|
16
16
|
"Last-Translator: heguyChen, 2023\n"
|
|
17
17
|
"Language-Team: Chinese Simplified (https://app.transifex.com/alliance-auth/"
|