fastapi 0.115.7__py3-none-any.whl → 0.115.8__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.8"
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)
@@ -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.8
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
@@ -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.8.dist-info/METADATA,sha256=4srjIseFlbNIV_5S9uJbfMX9VvUk21nJ_Hu0HnXMqe4,27152
2
+ fastapi-0.115.8.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ fastapi-0.115.8.dist-info/entry_points.txt,sha256=GCf-WbIZxyGT4MUmrPGj1cOHYZoGsNPHAvNkT6hnGeA,61
4
+ fastapi-0.115.8.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086
5
+ fastapi/__init__.py,sha256=_MYtqtXdcIyUpF2BUpb8Y-6UGaviGakeY05sV25X5DE,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
40
  fastapi/security/http.py,sha256=223bAV_d7NjI57Pzhbd_KlQTYlMyr5MoN1TW80rbxF8,13512
41
- fastapi/security/oauth2.py,sha256=BbXdQ_W2Pm5NIcpHGBSBa1u3t0EBLCgiYdOLfid1t4A,21585
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.8.dist-info/RECORD,,