fastapi 0.115.7__py3-none-any.whl → 0.115.9__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 fastapi might be problematic. Click here for more details.

fastapi/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
2
2
 
3
- __version__ = "0.115.7"
3
+ __version__ = "0.115.9"
4
4
 
5
5
  from starlette import status as status
6
6
 
@@ -9,7 +9,15 @@ from typing_extensions import Annotated, Doc
9
9
 
10
10
 
11
11
  class APIKeyBase(SecurityBase):
12
- pass
12
+ @staticmethod
13
+ def check_api_key(api_key: Optional[str], auto_error: bool) -> Optional[str]:
14
+ if not api_key:
15
+ if auto_error:
16
+ raise HTTPException(
17
+ status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"
18
+ )
19
+ return None
20
+ return api_key
13
21
 
14
22
 
15
23
  class APIKeyQuery(APIKeyBase):
@@ -101,14 +109,7 @@ class APIKeyQuery(APIKeyBase):
101
109
 
102
110
  async def __call__(self, request: Request) -> Optional[str]:
103
111
  api_key = request.query_params.get(self.model.name)
104
- if not api_key:
105
- if self.auto_error:
106
- raise HTTPException(
107
- status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"
108
- )
109
- else:
110
- return None
111
- return api_key
112
+ return self.check_api_key(api_key, self.auto_error)
112
113
 
113
114
 
114
115
  class APIKeyHeader(APIKeyBase):
@@ -196,14 +197,7 @@ class APIKeyHeader(APIKeyBase):
196
197
 
197
198
  async def __call__(self, request: Request) -> Optional[str]:
198
199
  api_key = request.headers.get(self.model.name)
199
- if not api_key:
200
- if self.auto_error:
201
- raise HTTPException(
202
- status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"
203
- )
204
- else:
205
- return None
206
- return api_key
200
+ return self.check_api_key(api_key, self.auto_error)
207
201
 
208
202
 
209
203
  class APIKeyCookie(APIKeyBase):
@@ -291,11 +285,4 @@ class APIKeyCookie(APIKeyBase):
291
285
 
292
286
  async def __call__(self, request: Request) -> Optional[str]:
293
287
  api_key = request.cookies.get(self.model.name)
294
- if not api_key:
295
- if self.auto_error:
296
- raise HTTPException(
297
- status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"
298
- )
299
- else:
300
- return None
301
- return api_key
288
+ return self.check_api_key(api_key, self.auto_error)
fastapi/security/http.py CHANGED
@@ -413,8 +413,11 @@ class HTTPDigest(HTTPBase):
413
413
  else:
414
414
  return None
415
415
  if scheme.lower() != "digest":
416
- raise HTTPException(
417
- status_code=HTTP_403_FORBIDDEN,
418
- detail="Invalid authentication credentials",
419
- )
416
+ if self.auto_error:
417
+ raise HTTPException(
418
+ status_code=HTTP_403_FORBIDDEN,
419
+ detail="Invalid authentication credentials",
420
+ )
421
+ else:
422
+ return None
420
423
  return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials)
@@ -63,7 +63,7 @@ class OAuth2PasswordRequestForm:
63
63
  *,
64
64
  grant_type: Annotated[
65
65
  Union[str, None],
66
- Form(pattern="password"),
66
+ Form(pattern="^password$"),
67
67
  Doc(
68
68
  """
69
69
  The OAuth2 spec says it is required and MUST be the fixed string
@@ -217,7 +217,7 @@ class OAuth2PasswordRequestFormStrict(OAuth2PasswordRequestForm):
217
217
  self,
218
218
  grant_type: Annotated[
219
219
  str,
220
- Form(pattern="password"),
220
+ Form(pattern="^password$"),
221
221
  Doc(
222
222
  """
223
223
  The OAuth2 spec says it is required and MUST be the fixed string
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastapi
3
- Version: 0.115.7
3
+ Version: 0.115.9
4
4
  Summary: FastAPI framework, high performance, easy to learn, fast to code, ready for production
5
5
  Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
6
6
  Classifier: Intended Audience :: Information Technology
@@ -29,6 +29,7 @@ Classifier: Programming Language :: Python :: 3.9
29
29
  Classifier: Programming Language :: Python :: 3.10
30
30
  Classifier: Programming Language :: Python :: 3.11
31
31
  Classifier: Programming Language :: Python :: 3.12
32
+ Classifier: Programming Language :: Python :: 3.13
32
33
  Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
33
34
  Classifier: Topic :: Internet :: WWW/HTTP
34
35
  Project-URL: Homepage, https://github.com/fastapi/fastapi
@@ -70,7 +71,7 @@ Description-Content-Type: text/markdown
70
71
  </p>
71
72
  <p align="center">
72
73
  <a href="https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank">
73
- <img src="https://github.com/fastapi/fastapi/workflows/Test/badge.svg?event=push&branch=master" alt="Test">
74
+ <img src="https://github.com/fastapi/fastapi/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Test">
74
75
  </a>
75
76
  <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi" target="_blank">
76
77
  <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi.svg" alt="Coverage">
@@ -121,11 +122,13 @@ The key features are:
121
122
  <a href="https://zuplo.link/fastapi-gh" target="_blank" title="Zuplo: Scale, Protect, Document, and Monetize your FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/zuplo.png"></a>
122
123
  <a href="https://liblab.com?utm_source=fastapi" target="_blank" title="liblab - Generate SDKs from FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/liblab.png"></a>
123
124
  <a href="https://docs.render.com/deploy-fastapi?utm_source=deploydoc&utm_medium=referral&utm_campaign=fastapi" target="_blank" title="Deploy & scale any full-stack web app on Render. Focus on building apps, not infra."><img src="https://fastapi.tiangolo.com/img/sponsors/render.svg"></a>
125
+ <a href="https://www.coderabbit.ai/?utm_source=fastapi&utm_medium=badge&utm_campaign=fastapi" target="_blank" title="Cut Code Review Time & Bugs in Half with CodeRabbit"><img src="https://fastapi.tiangolo.com/img/sponsors/coderabbit.png"></a>
124
126
  <a href="https://github.com/deepset-ai/haystack/" target="_blank" title="Build powerful search from composable, open source building blocks"><img src="https://fastapi.tiangolo.com/img/sponsors/haystack-fastapi.svg"></a>
125
127
  <a href="https://databento.com/" target="_blank" title="Pay as you go for market data"><img src="https://fastapi.tiangolo.com/img/sponsors/databento.svg"></a>
126
128
  <a href="https://speakeasy.com?utm_source=fastapi+repo&utm_medium=github+sponsorship" target="_blank" title="SDKs for your API | Speakeasy"><img src="https://fastapi.tiangolo.com/img/sponsors/speakeasy.png"></a>
127
129
  <a href="https://www.svix.com/" target="_blank" title="Svix - Webhooks as a service"><img src="https://fastapi.tiangolo.com/img/sponsors/svix.svg"></a>
128
130
  <a href="https://www.stainlessapi.com/?utm_source=fastapi&utm_medium=referral" target="_blank" title="Stainless | Generate best-in-class SDKs"><img src="https://fastapi.tiangolo.com/img/sponsors/stainless.png"></a>
131
+ <a href="https://www.permit.io/blog/implement-authorization-in-fastapi?utm_source=github&utm_medium=referral&utm_campaign=fastapi" target="_blank" title="Fine-Grained Authorization for FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/permit.png"></a>
129
132
 
130
133
  <!-- /sponsors -->
131
134
 
@@ -1,8 +1,8 @@
1
- fastapi-0.115.7.dist-info/METADATA,sha256=l7odQfcUJbwC775AF8m6m92HVzEp6MkoxMsSzH-Eg1A,27101
2
- fastapi-0.115.7.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- fastapi-0.115.7.dist-info/entry_points.txt,sha256=GCf-WbIZxyGT4MUmrPGj1cOHYZoGsNPHAvNkT6hnGeA,61
4
- fastapi-0.115.7.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
5
- fastapi/__init__.py,sha256=Av5a_p_jzaCRpJx9pGytQuyaCqnrGRP2VFybtfgqocg,1081
1
+ fastapi-0.115.9.dist-info/METADATA,sha256=qNFIdi71Tm9P44iu-YIzDFlPXopyaCQ5WTEg-0K9mbY,27670
2
+ fastapi-0.115.9.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ fastapi-0.115.9.dist-info/entry_points.txt,sha256=GCf-WbIZxyGT4MUmrPGj1cOHYZoGsNPHAvNkT6hnGeA,61
4
+ fastapi-0.115.9.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
5
+ fastapi/__init__.py,sha256=rFYG1lpUkCjrWJdXVgOkHIX5GLdMRwurTOKLNYN96yk,1081
6
6
  fastapi/__main__.py,sha256=bKePXLdO4SsVSM6r9SVoLickJDcR2c0cTOxZRKq26YQ,37
7
7
  fastapi/_compat.py,sha256=Rg7kA7uue4Z6yr8T7hf8b7G6PeC_06mK004Nnykijfk,23953
8
8
  fastapi/applications.py,sha256=Ix-o9pQAWhEDf9J0Q1hZ0nBB1uP72c-Y3oiYzvrwqiM,176316
@@ -35,10 +35,10 @@ fastapi/requests.py,sha256=zayepKFcienBllv3snmWI20Gk0oHNVLU4DDhqXBb4LU,142
35
35
  fastapi/responses.py,sha256=QNQQlwpKhQoIPZTTWkpc9d_QGeGZ_aVQPaDV3nQ8m7c,1761
36
36
  fastapi/routing.py,sha256=WK06IwZeyRwxkdB4uHZ7JXinxtVOxM8Ke0tqHaDOvYA,176208
37
37
  fastapi/security/__init__.py,sha256=bO8pNmxqVRXUjfl2mOKiVZLn0FpBQ61VUYVjmppnbJw,881
38
- fastapi/security/api_key.py,sha256=_OqUUjEHG5_MT1IPAhXIGJRCPldTBdSww_DegFy_W8Y,9368
38
+ fastapi/security/api_key.py,sha256=cBI5Z4zWVjL1uJrsjTeLy7MafHPAO2HQPzTrpyoIYWA,9094
39
39
  fastapi/security/base.py,sha256=dl4pvbC-RxjfbWgPtCWd8MVU-7CB2SZ22rJDXVCXO6c,141
40
- fastapi/security/http.py,sha256=223bAV_d7NjI57Pzhbd_KlQTYlMyr5MoN1TW80rbxF8,13512
41
- fastapi/security/oauth2.py,sha256=BbXdQ_W2Pm5NIcpHGBSBa1u3t0EBLCgiYdOLfid1t4A,21585
40
+ fastapi/security/http.py,sha256=rWR2x-5CUsjWmRucYthwRig6MG1o-boyrr4Xo-PuuxU,13606
41
+ fastapi/security/oauth2.py,sha256=xCo5j1qpze6CvEuJHIneOI0v2fodGVMpHHVnHpiLfoM,21589
42
42
  fastapi/security/open_id_connect_url.py,sha256=8vizZ2tGqEp1ur8SwtVgyHJhGAJ5AqahgcvSpaIioDI,2722
43
43
  fastapi/security/utils.py,sha256=bd8T0YM7UQD5ATKucr1bNtAvz_Y3__dVNAv5UebiPvc,293
44
44
  fastapi/staticfiles.py,sha256=iirGIt3sdY2QZXd36ijs3Cj-T0FuGFda3cd90kM9Ikw,69
@@ -47,4 +47,4 @@ fastapi/testclient.py,sha256=nBvaAmX66YldReJNZXPOk1sfuo2Q6hs8bOvIaCep6LQ,66
47
47
  fastapi/types.py,sha256=nFb36sK3DSoqoyo7Miwy3meKK5UdFBgkAgLSzQlUVyI,383
48
48
  fastapi/utils.py,sha256=y8Bj5ttMaI9tS4D60OUgXqKnktBr99NdYUnHHV9LgoY,7948
49
49
  fastapi/websockets.py,sha256=419uncYObEKZG0YcrXscfQQYLSWoE10jqxVMetGdR98,222
50
- fastapi-0.115.7.dist-info/RECORD,,
50
+ fastapi-0.115.9.dist-info/RECORD,,