apitally 0.20.0__py3-none-any.whl → 0.20.1__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.
apitally/blacksheep.py CHANGED
@@ -128,7 +128,7 @@ class ApitallyMiddleware:
128
128
  return None
129
129
 
130
130
  async def __call__(self, request: Request, handler: Callable[[Request], Awaitable[Response]]) -> Response:
131
- if not self.client.enabled:
131
+ if not self.client.enabled or request.method.upper() == "OPTIONS":
132
132
  return await handler(request)
133
133
 
134
134
  timestamp = time.time()
@@ -188,7 +188,7 @@ class ApitallyMiddleware:
188
188
  if response_size is None or response_size < 0:
189
189
  response_size = len(response_body)
190
190
 
191
- if route_pattern and request.method.upper() != "OPTIONS":
191
+ if route_pattern:
192
192
  self.client.request_counter.add_request(
193
193
  consumer=consumer_identifier,
194
194
  method=request.method.upper(),
@@ -251,7 +251,7 @@ def _get_startup_data(app: Application, app_version: Optional[str] = None) -> Di
251
251
  def _get_paths(app: Application) -> List[Dict[str, str]]:
252
252
  openapi = OpenAPIHandler(info=Info(title="", version=""))
253
253
  paths = []
254
- methods = ("get", "put", "post", "delete", "options", "head", "patch", "trace")
254
+ methods = ("get", "put", "post", "delete", "patch")
255
255
  for path, path_item in openapi.get_paths(app).items():
256
256
  for method in methods:
257
257
  operation: Operation = getattr(path_item, method, None)
apitally/flask.py CHANGED
@@ -102,7 +102,7 @@ class ApitallyMiddleware:
102
102
  self.client.start_sync_loop()
103
103
 
104
104
  def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]:
105
- if not self.client.enabled:
105
+ if not self.client.enabled or environ.get("REQUEST_METHOD") == "OPTIONS":
106
106
  return self.wsgi_app(environ, start_response)
107
107
 
108
108
  timestamp = time.time()
@@ -180,7 +180,7 @@ class ApitallyMiddleware:
180
180
  consumer_identifier = consumer.identifier if consumer else None
181
181
  self.client.consumer_registry.add_or_update_consumer(consumer)
182
182
 
183
- if path is not None and request.method != "OPTIONS":
183
+ if path is not None:
184
184
  self.client.request_counter.add_request(
185
185
  consumer=consumer_identifier,
186
186
  method=request.method,
apitally/litestar.py CHANGED
@@ -327,5 +327,5 @@ def _get_routes(app: Litestar) -> List[Dict[str, str]]:
327
327
  {"method": method, "path": route.path}
328
328
  for route in app.routes
329
329
  for method in route.methods
330
- if route.scope_type == ScopeType.HTTP and method != "OPTIONS"
330
+ if route.scope_type == ScopeType.HTTP and method not in ["OPTIONS", "HEAD"]
331
331
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apitally
3
- Version: 0.20.0
3
+ Version: 0.20.1
4
4
  Summary: Simple API monitoring & analytics for REST APIs built with FastAPI, Flask, Django, Starlette, Litestar and BlackSheep.
5
5
  Project-URL: Homepage, https://apitally.io
6
6
  Project-URL: Documentation, https://docs.apitally.io
@@ -1,12 +1,12 @@
1
1
  apitally/__init__.py,sha256=ShXQBVjyiSOHxoQJS2BvNG395W4KZfqMxZWBAR0MZrE,22
2
- apitally/blacksheep.py,sha256=Hal2WNAj0xe6ap6W8hrILrWlhFPmMNZXGjZS99eWBO0,10673
2
+ apitally/blacksheep.py,sha256=jAkK20OcmV--_Y-RsXDIApRj8bX2eKf_u7ClDtAPvBc,10644
3
3
  apitally/common.py,sha256=azDxepViH0QW0MuufTHxeSQyLGzCkocAX_KPziWTx8A,1605
4
4
  apitally/django.py,sha256=hU3m1wf5E1qWAHsNjyZG1FEGcbsw3Tud8Vku0218C1Q,19412
5
5
  apitally/django_ninja.py,sha256=-CmrwFFRv7thFOUK_OrOSouhHL9bm5sIBNIQlpyE_2c,166
6
6
  apitally/django_rest_framework.py,sha256=-CmrwFFRv7thFOUK_OrOSouhHL9bm5sIBNIQlpyE_2c,166
7
7
  apitally/fastapi.py,sha256=uLAftbIHUmZSCc3ZPpNblIFS9Se5lUhNyj3-nqFKuVU,555
8
- apitally/flask.py,sha256=DBn-kUP2KfCjFNHJfTOQXswWjLW-G0N2UeuOjOaDS_M,10592
9
- apitally/litestar.py,sha256=wLcet0dLP1zbp-VA-P83Wc-GqVW6FAAlmC2Tu7AW_Jo,14586
8
+ apitally/flask.py,sha256=5sN6YvOqpfjTY8CPRw6FChfTp2-ax0lvHryQrbNeiSU,10606
9
+ apitally/litestar.py,sha256=-01nxP4ZM29vAXJCtqxmn4BucEHhXRwi84z_i0TZPbs,14600
10
10
  apitally/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  apitally/starlette.py,sha256=r3jVy-JEdc572BatOkHTCItY8jfj-AEFNYtpiAX6WfU,15240
12
12
  apitally/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -20,7 +20,7 @@ apitally/client/requests.py,sha256=SDptGOg9XvaEKFj2o3oxJz-JAuZzUrqpHnbOQixf99o,3
20
20
  apitally/client/sentry.py,sha256=dXW2zf-wexYSp4CJBsFFRKz9jWkPBy0ftqIk0o5Hkq8,1364
21
21
  apitally/client/server_errors.py,sha256=4B2BKDFoIpoWc55UVH6AIdYSgzj6zxCdMNUW77JjhZw,3423
22
22
  apitally/client/validation_errors.py,sha256=6G8WYWFgJs9VH9swvkPXJGuOJgymj5ooWA9OwjUTbuM,1964
23
- apitally-0.20.0.dist-info/METADATA,sha256=vwH71JGd1sVm9gYGtCBu-avBa18DI8zYCGG3tyjDlUE,9316
24
- apitally-0.20.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
- apitally-0.20.0.dist-info/licenses/LICENSE,sha256=vbLzC-4TddtXX-_AFEBKMYWRlxC_MN0g66QhPxo8PgY,1065
26
- apitally-0.20.0.dist-info/RECORD,,
23
+ apitally-0.20.1.dist-info/METADATA,sha256=HeXviknfeo_NLF27Xz1pi_oYRpW12mAr4HeQUbrE0wo,9316
24
+ apitally-0.20.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ apitally-0.20.1.dist-info/licenses/LICENSE,sha256=vbLzC-4TddtXX-_AFEBKMYWRlxC_MN0g66QhPxo8PgY,1065
26
+ apitally-0.20.1.dist-info/RECORD,,