django-esi 8.0.0a4__py3-none-any.whl → 8.0.0b1__py3-none-any.whl

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-esi
3
- Version: 8.0.0a4
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[http2, brotli, zstd]
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,52 +1,52 @@
1
- esi/__init__.py,sha256=AJRGqO80Mo5rJTmvrH2T1RcuhIWbecQzOXbjP_812Ow,205
1
+ esi/__init__.py,sha256=vsNIce83g99LxdSg1jj7tPr0a4Eq2SwB-9SfKADjZUM,204
2
2
  esi/admin.py,sha256=9i68WwW_gR0zsGhJKTWK2yMEi44EkhpAaOW0LDpVfM8,1176
3
3
  esi/app_settings.py,sha256=2Jp_1myzKCL8A20RYvwQnQd04Ds_CBGsCqwDtsrYf0M,4289
4
4
  esi/apps.py,sha256=HIu1niTkOXYmCzMVAjYcaFhHrrXeBbHvui6I44OCHXw,280
5
5
  esi/checks.py,sha256=31puQdsrpRUJB-kedp2k7Evo0x2knTWQPZsCUUrJ3dY,1912
6
- esi/clients.py,sha256=WB5YseJnfZdTeJ9C1Eze-iWXEqIpo5i_8uiQ6w0VkCw,23503
6
+ esi/clients.py,sha256=KNFNa5SXFshifap84Q1rCNgZusQ3vmRlePIQG3XICUE,23894
7
7
  esi/decorators.py,sha256=2RmPdkrIAwbxOV5Ls8-RIWd_VhmXEDzIG6g5-bs6WZc,9093
8
8
  esi/errors.py,sha256=KfFtgX8Mys4uMoQtco0n_pQeaM83yVrRSyW6StXuUjo,308
9
9
  esi/exceptions.py,sha256=nR-Z0BXVt5xSkgUL56E97pqtTyEu3MFr8_P0uCCCQ-E,1448
10
- esi/helpers.py,sha256=-lYojtcWYWtlC_olSItWR3O3zJpjMYTQpNvsax81us8,672
10
+ esi/helpers.py,sha256=pafq8XZ6NAsaOYNqAvgbJ4n0JHCopDtUd3h_HWLcg4c,2206
11
11
  esi/managers.py,sha256=zdri1aSJrSX9W_kwzbXq44CAAhdufikoOViaJntA41A,11443
12
12
  esi/managers.pyi,sha256=BxRNX2yOT3domdrxsuGp4G0TrP_bWmf8VVwvM03eHQE,1977
13
13
  esi/models.py,sha256=MEY8jmHGwA8ZJjq37h-vC8LnOVn_Mnv5Gw0NoI9tkXk,11484
14
- esi/openapi_clients.py,sha256=8NoWqH24z3nOCo4JOhcMJJkY9TGmBXdpDb4zsCD60WQ,40135
14
+ esi/openapi_clients.py,sha256=kmijZukB7wICIG5lCEd_3uRha0qAR_sKyHn48V4azts,41127
15
15
  esi/rate_limiting.py,sha256=fUzso1YCHlBes8SVrEAsP58eRWcFNuO2XEkW6RQLhUE,2600
16
16
  esi/stubs.py,sha256=UakysEAq5V454oKbxyEUewncr5sCFZCgwHFh0SJvU3Y,30
17
- esi/stubs.pyi,sha256=gJzK6pizZV0OGIojAE0qfe5gtTod3YaOemRgGnI8R08,244125
17
+ esi/stubs.pyi,sha256=ua9zHzZtrWct1mj_UV1pN7HJyA2RxqWPYapL7DQMRYA,244089
18
18
  esi/tasks.py,sha256=TaE_Q03oLk1ohkPw8KknXpIK-nY47C-oaGUUu4nr8pw,2658
19
19
  esi/urls.py,sha256=B4EnmT-MZzs4F8a9ORK1ejAHbpGRN_V4TKks8ww3JGE,151
20
20
  esi/views.py,sha256=cq2JkqSAwx-Nqi3amRUA9CKLu3ZLQYHSAH8c8g7xIQ4,3917
21
- esi/aiopenapi3/plugins.py,sha256=4erd3dL6bSMEp_AeB7JWnRZPnOSRrZHK5QsHaGJilBg,5001
21
+ esi/aiopenapi3/plugins.py,sha256=jMW82FM-g_aL-RfmB7ip3xmXF1-Evq-euv3KMbEfWds,7898
22
22
  esi/locale/cs_CZ/LC_MESSAGES/django.mo,sha256=WyxsjDEeArGMNhtpY2eCJjdENMDmmxdxz4oW1s4N5eA,391
23
- esi/locale/cs_CZ/LC_MESSAGES/django.po,sha256=f4fVr2btQpIeeMaqZL0tpj0j06Evwe2xPHh1OH6gPuU,1318
23
+ esi/locale/cs_CZ/LC_MESSAGES/django.po,sha256=mlmqr5WqKZr7AI1AGPYt7W10vfJmvgLddbD16ClX5hQ,1317
24
24
  esi/locale/de/LC_MESSAGES/django.mo,sha256=uNJPd25k3AUU6FceBsJV9pqCpM1ZW4wDDFKNZkPlXqg,874
25
- esi/locale/de/LC_MESSAGES/django.po,sha256=YVZKMGC0jeZltrhlY2I4wXWmlf5tRgjw6IcLpIUkNsk,1564
25
+ esi/locale/de/LC_MESSAGES/django.po,sha256=ahUQxXocWCsyE7xj5OpG4iBDeE4cL1Xdm-OQvf7N-Q4,1563
26
26
  esi/locale/en/LC_MESSAGES/django.mo,sha256=gtTXjZjZ18WCvehANkW-Uo_YU4dOolu57DYXtWnOZkA,434
27
- esi/locale/en/LC_MESSAGES/django.po,sha256=LGrMRv02ftr0c470FRija9WOrz4NZcLor7XR_O2WGgQ,1365
27
+ esi/locale/en/LC_MESSAGES/django.po,sha256=CeihWA8VviLtx-x1sS3lr10nNLOyg1wEQZGeBBbyK8g,1364
28
28
  esi/locale/es/LC_MESSAGES/django.mo,sha256=XegUUE14RGv9SYxO7FoJjz2jNvG64hA8oOFhqjYZc8g,791
29
- esi/locale/es/LC_MESSAGES/django.po,sha256=OvqlzHQkuaODF1IZhTWj22d3zvtzLCYgX-XQZdbcyZg,1568
29
+ esi/locale/es/LC_MESSAGES/django.po,sha256=yAF4Kcv9px0utUmAhYuQnaZzS4SDwEA0cax4hOx_e6k,1567
30
30
  esi/locale/fr_FR/LC_MESSAGES/django.mo,sha256=FFAiYNUgD1zv056mRf3actNPDDIagu3Bb13EXaAlV94,697
31
- esi/locale/fr_FR/LC_MESSAGES/django.po,sha256=vAiDmUPmqP9AGs6rqo-mX3rsda6QZFQvADMr6pmGlgk,1577
31
+ esi/locale/fr_FR/LC_MESSAGES/django.po,sha256=L4noD0WBE2389Zzo2k5rxUWWhAO5Obm7eyVOOF4TDxY,1576
32
32
  esi/locale/it_IT/LC_MESSAGES/django.mo,sha256=SicuHgSlkdIV-Jc9QuR4JaC8QwfycDznJR0yuP9jCoI,931
33
- esi/locale/it_IT/LC_MESSAGES/django.po,sha256=sh7kXEfDlJy94VCwknwQbJMobn9xCNA1_zuzs_keLHc,1624
33
+ esi/locale/it_IT/LC_MESSAGES/django.po,sha256=DNwyc7pZuFXYthb07SIFTRNowLiXhkk1X9OwuKa-MXE,1623
34
34
  esi/locale/ja/LC_MESSAGES/django.mo,sha256=0900q-CQ5WT98zWn746YfdOy51uE_nlEbJyxogqxrvc,761
35
- esi/locale/ja/LC_MESSAGES/django.po,sha256=4NBEUf6NwYI_DempuOkjaZFuJ_71aWsEZS6yHhGsRpw,1537
35
+ esi/locale/ja/LC_MESSAGES/django.po,sha256=kpVz2TLwFYGCc1vkCXiMBhLk9LkBypox6oIF0rmGBW8,1536
36
36
  esi/locale/ko_KR/LC_MESSAGES/django.mo,sha256=7NktQKVols2D9r8LH0fVmNXtF4L3tmKyAf90IoRhSAY,800
37
- esi/locale/ko_KR/LC_MESSAGES/django.po,sha256=J-qdtO_4P9j0-qyfRDbw9M_BIEiSKSU_tq3IbcNsFFQ,1572
37
+ esi/locale/ko_KR/LC_MESSAGES/django.po,sha256=PQrNrTxw6bTU43KUSNc0okGXes21cSZ3_4MAhBIA1jw,1571
38
38
  esi/locale/nl_NL/LC_MESSAGES/django.mo,sha256=WyxsjDEeArGMNhtpY2eCJjdENMDmmxdxz4oW1s4N5eA,391
39
- esi/locale/nl_NL/LC_MESSAGES/django.po,sha256=f4fVr2btQpIeeMaqZL0tpj0j06Evwe2xPHh1OH6gPuU,1318
39
+ esi/locale/nl_NL/LC_MESSAGES/django.po,sha256=mlmqr5WqKZr7AI1AGPYt7W10vfJmvgLddbD16ClX5hQ,1317
40
40
  esi/locale/pl_PL/LC_MESSAGES/django.mo,sha256=WyxsjDEeArGMNhtpY2eCJjdENMDmmxdxz4oW1s4N5eA,391
41
- esi/locale/pl_PL/LC_MESSAGES/django.po,sha256=f4fVr2btQpIeeMaqZL0tpj0j06Evwe2xPHh1OH6gPuU,1318
41
+ esi/locale/pl_PL/LC_MESSAGES/django.po,sha256=mlmqr5WqKZr7AI1AGPYt7W10vfJmvgLddbD16ClX5hQ,1317
42
42
  esi/locale/ru/LC_MESSAGES/django.mo,sha256=g9515s_BB2pyCJe9-oqPXGEU7vc0EdFoh1SpTUCkGus,1128
43
- esi/locale/ru/LC_MESSAGES/django.po,sha256=s5p5D5ILhwQJr2eoe11xPdDxR-BttWGh1OuQ3PZV4Lk,1879
43
+ esi/locale/ru/LC_MESSAGES/django.po,sha256=pBczyt5Ri0MD7NB_zCC7FFxFOrTOFIMeN7zMi8b0slM,1878
44
44
  esi/locale/sk/LC_MESSAGES/django.mo,sha256=eWUijXSFZNruadb-y-FXso0-1a9lbp6zUPWS2kMoZi4,509
45
- esi/locale/sk/LC_MESSAGES/django.po,sha256=FuCsSPv580yZ7py6bWL_PgBA4cj7HmmS4-4-hz4l518,1443
45
+ esi/locale/sk/LC_MESSAGES/django.po,sha256=9QbaP8YZzsA3IJMq9hNprU3DxeQteaTfXZlqKloGYMM,1442
46
46
  esi/locale/uk/LC_MESSAGES/django.mo,sha256=LlEo98zaX1whlyZTn_UqXyNOa5rKleqem1XcoKvZ40E,656
47
- esi/locale/uk/LC_MESSAGES/django.po,sha256=46ZA2mjbgClqMK-I0FnBIKiTYOVoDMs-o5M8QgcHsfk,1596
47
+ esi/locale/uk/LC_MESSAGES/django.po,sha256=-NCRwISPt1wkk-LQKkCbYupI5ouDVNtRrum_1vqqS3A,1595
48
48
  esi/locale/zh_Hans/LC_MESSAGES/django.mo,sha256=O2csJQMFxmvSWM4iNfNozHAQjAAd76LwFy0sx3oLHCY,735
49
- esi/locale/zh_Hans/LC_MESSAGES/django.po,sha256=tNaPILQzZK2v6YyBxmq3FOKWdQUFn-9I2kWpF3thBKk,1512
49
+ esi/locale/zh_Hans/LC_MESSAGES/django.po,sha256=vcU0X-11Pj6WJNXcMRR7HaQ-7JcETNgiTFQKru5IL0Y,1511
50
50
  esi/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  esi/management/commands/generate_esi_stubs.py,sha256=dunWHFSRb6NFu5emeDdskqIt3YqnEqQLBiuNERMkdmE,9798
52
52
  esi/management/commands/migrate_to_ssov2.py,sha256=x9W4xaefrNoG_dNscHIWrWTRk4SuVGIW0s44q2QBN9k,6427
@@ -71,27 +71,27 @@ esi/static/esi/img/EVE_SSO_Login_Buttons_Small_White.png,sha256=al3NRjIngZtrNzEx
71
71
  esi/templates/esi/select_token.html,sha256=qofOjKWHco_sSuoEJoLRsXP_doK_barHvkF7h5LLxjY,6941
72
72
  esi/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  esi/templatetags/scope_tags.py,sha256=5-7vEwe-B91xo7oSnn-tSuudHSJCoGIhbddDpNrqUnw,167
74
- esi/tests/__init__.py,sha256=1ymL-74_4alt8AQNs7cFiXO5MmQKlIeOcA4OPOdAitM,3092
74
+ esi/tests/__init__.py,sha256=SWXR4QgKWg_ZdwOG4vJoRKcd8zQ11dz3z2-Oifdq5kA,3091
75
75
  esi/tests/client_authed_pilot.py,sha256=GN0J59TcscHM9HZH6OaPODM9Zel3mvObjJ4Dmmzc2j8,1622
76
76
  esi/tests/client_public_pilot.py,sha256=u6P-qbdYSvQ6A_MJqt8Jrkswt-u-FlvYDKtCvA5-PMo,1252
77
77
  esi/tests/factories.py,sha256=2pjkSYKDfO50bzX1nNcUHz_FAAJs7k07u7R8om6AlP0,1375
78
78
  esi/tests/factories_2.py,sha256=25NqVe9zzHkl4U1EN3R7pjdN2ahIBXxrrJhQzZhvw58,1972
79
79
  esi/tests/jwt_factory.py,sha256=0Jj9TjEv18h2XVsRpYc7BWHr3CPtQJgfKeB-9mdHevk,4919
80
80
  esi/tests/test_checks.py,sha256=ntq2ijuJ-6pxGruNh21rM4GlXDLVm-o3sy8DrFbjwEM,1846
81
- esi/tests/test_clients.py,sha256=1JWTBV83nZbt82e37DAnJ7h4gm9m_xU1ZDvEjt0sHsc,41363
81
+ esi/tests/test_clients.py,sha256=qoiv3OztuhjizNknZplJhwnMzAlX689MGad4Azu809M,44163
82
82
  esi/tests/test_decorators.py,sha256=I5MhcLKhN5xD4PxgEQqOWQ2kiXquDqQIEve9dbTOsho,15069
83
83
  esi/tests/test_management_command.py,sha256=mtxfBtG6CHP1bTy1tJEO-djX4SQwMT3T_mqGnUIM6qs,9863
84
84
  esi/tests/test_managers.py,sha256=CEpjXSXyVY6xxgrs0f9FnEh-KY9JPaKjKYiutXLLShE,24309
85
85
  esi/tests/test_models.py,sha256=lDj5IcYgXHeOFTHXTsWGg13CSooFaxD0c51kJn_ytAc,13748
86
86
  esi/tests/test_openapi.json,sha256=rGvX02M_LmMoWRTVZZ7NkGzc3-lQy7-2WQCrt6DlqM0,11828
87
- esi/tests/test_openapi.py,sha256=yWgm7clO_RfWxOWGmAYFr0oAp1jzgFmnbIRWjDucp9E,7988
87
+ esi/tests/test_openapi.py,sha256=VCDbEENoHZbrNJiLzSTvjIkMNR3huAl3522v5XJ3XRg,12445
88
88
  esi/tests/test_swagger.json,sha256=HOrPgbvwm5N521QNcE3baWcZJkSjmuN_VWrR06wEQoo,17241
89
89
  esi/tests/test_swagger_full.json,sha256=JCEAZNMFhkdZhquTx4lDhrqGgCrzzzlYU64HdbEv8E4,2548369
90
90
  esi/tests/test_tasks.py,sha256=nIvfXax_8nQCxNQeT-4TJ84i0__t1qWe155z5rnsktQ,4399
91
91
  esi/tests/test_templatetags.py,sha256=b68JWE3HvOlr2aUisJHsTsDS4e7IMjDeqTuzMqC7Re4,517
92
92
  esi/tests/test_views.py,sha256=Kj_f2yIpmPG0kx-lAX_sfkaHlIpgbkm02ieA1V3o-k4,13073
93
93
  esi/tests/threading_pilot.py,sha256=ax_dEdnTNibA-UQHqbZle_2dh_3jcHKRyrYSOKuE_6U,1931
94
- django_esi-8.0.0a4.dist-info/licenses/LICENSE,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
95
- django_esi-8.0.0a4.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
96
- django_esi-8.0.0a4.dist-info/METADATA,sha256=71zaRb8BRkKRsA6L8vFFb34wbnDqUmQw639Kh1hCE9s,4738
97
- django_esi-8.0.0a4.dist-info/RECORD,,
94
+ django_esi-8.0.0b1.dist-info/licenses/LICENSE,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
95
+ django_esi-8.0.0b1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
96
+ django_esi-8.0.0b1.dist-info/METADATA,sha256=jGWQujfVYTjC6wNdXUx6toYBwn5jV0QisqQuUJC9-QY,4789
97
+ django_esi-8.0.0b1.dist-info/RECORD,,
esi/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Django app for accessing the EVE Swagger Interface (ESI)."""
2
2
 
3
- __version__ = "8.0.0-alpha.4"
3
+ __version__ = "8.0.0-beta.1"
4
4
  __title__ = 'Django-ESI'
5
5
  __url__ = 'https://gitlab.com/allianceauth/django-esi'
6
6
  __build_date__ = "2025-09-18"
esi/aiopenapi3/plugins.py CHANGED
@@ -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
- print("PatchCompatibilityDatePlugin: making compatibility date optional")
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
esi/clients.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  import logging
3
3
  import warnings
4
- from datetime import datetime
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
- delta = expires_dt - datetime.utcnow()
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}) {__title__}/{__version__} (+{__url__})"
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"{__title__}/{__version__} ({app_settings.ESI_USER_CONTACT_EMAIL}; +{__url__})"
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
- user_agent = f"{ua_appname}/{ua_version} ({app_settings.ESI_USER_CONTACT_EMAIL}{f'; +{ua_url})' if ua_url else ')'} {__title__}/{__version__} (+{__url__})"
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
 
esi/helpers.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from esi.models import Token
2
+ from string import capwords
2
3
 
3
4
 
4
5
  def get_token(character_id: int, scopes: list) -> Token:
@@ -23,3 +24,39 @@ def get_token(character_id: int, scopes: list) -> Token:
23
24
  f"No valid token found for character_id={character_id} with required scopes."
24
25
  )
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
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: Django ESI 8.0.0-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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/"
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: Django ESI 8.0.0-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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-alpha.4\n"
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-09-21 13:23+1000\n"
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/"