kinto 19.3.0__py3-none-any.whl → 19.3.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.

Potentially problematic release.


This version of kinto might be problematic. Click here for more details.

@@ -1,6 +1,7 @@
1
1
  import logging
2
2
  import random
3
3
  import re
4
+ import urllib.parse
4
5
  import warnings
5
6
  from datetime import datetime
6
7
  from secrets import token_hex
@@ -474,6 +475,7 @@ def setup_metrics(config):
474
475
 
475
476
  try:
476
477
  endpoint = utils.strip_uri_prefix(request.path)
478
+ endpoint = urllib.parse.quote_plus(endpoint, safe="/?&=-_")
477
479
  except UnicodeDecodeError as e:
478
480
  # This `on_new_response` callback is also called when a HTTP 400
479
481
  # is returned because of an invalid UTF-8 path. We still want metrics.
@@ -507,7 +509,7 @@ def setup_metrics(config):
507
509
  unique=[
508
510
  ("method", request.method.lower()),
509
511
  ("endpoint", endpoint),
510
- ("status", str(request.response.status_code)),
512
+ ("status", str(event.response.status_code)),
511
513
  ]
512
514
  + metrics_matchdict_labels,
513
515
  )
@@ -527,7 +529,7 @@ def setup_metrics(config):
527
529
  # Observe response size.
528
530
  metrics_service.observe(
529
531
  "request_size",
530
- len(request.response.body or b""),
532
+ len(event.response.body or b""),
531
533
  labels=[("endpoint", endpoint)] + metrics_matchdict_labels,
532
534
  )
533
535
 
@@ -665,7 +665,7 @@ class Resource:
665
665
  obj = self._get_object_or_404(self.object_id)
666
666
  self._raise_412_if_modified(obj)
667
667
 
668
- # Retreive the last_modified information from a querystring if present.
668
+ # Retrieve the last_modified information from a querystring if present.
669
669
  last_modified = self.request.validated["querystring"].get("last_modified")
670
670
 
671
671
  # If less or equal than current object. Ignore it.
@@ -1060,7 +1060,8 @@ class Resource:
1060
1060
  """Extracts filters from QueryString parameters."""
1061
1061
 
1062
1062
  def is_valid_timestamp(value):
1063
- return isinstance(value, int) or re.match(r'^"?\d+"?$', str(value))
1063
+ # Is either integer, or integer as string, or integer between 2 quotes.
1064
+ return isinstance(value, int) or re.match(r'^(\d+)$|^("\d+")$', str(value))
1064
1065
 
1065
1066
  queryparams = self.request.validated["querystring"]
1066
1067
 
kinto/plugins/statsd.py CHANGED
@@ -13,6 +13,14 @@ except ImportError: # pragma: no cover
13
13
  statsd_module = None
14
14
 
15
15
 
16
+ def sanitize(value):
17
+ """
18
+ Telegraf does not support ':' in values.
19
+ See https://github.com/influxdata/telegraf/issues/4495
20
+ """
21
+ return value.replace(":", "") if isinstance(value, str) else value
22
+
23
+
16
24
  @implementer(metrics.IMetricsService)
17
25
  class StatsDService:
18
26
  def __init__(self, host, port, prefix):
@@ -22,7 +30,7 @@ class StatsDService:
22
30
  return self._client.timer(key)
23
31
 
24
32
  def observe(self, key, value, labels=[]):
25
- return self._client.gauge(key, value)
33
+ return self._client.gauge(key, sanitize(value))
26
34
 
27
35
  def count(self, key, count=1, unique=None):
28
36
  if unique is None:
@@ -30,7 +38,7 @@ class StatsDService:
30
38
  if isinstance(unique, list):
31
39
  # [("method", "get")] -> "method.get"
32
40
  # [("endpoint", "/"), ("method", "get")] -> "endpoint./.method.get"
33
- unique = ".".join(f"{label[0]}.{label[1]}" for label in unique)
41
+ unique = ".".join(f"{label[0]}.{sanitize(label[1])}" for label in unique)
34
42
  else:
35
43
  warnings.warn(
36
44
  "`unique` parameter should be of type ``list[tuple[str, str]]``",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kinto
3
- Version: 19.3.0
3
+ Version: 19.3.1
4
4
  Summary: Kinto Web Service - Store, Sync, Share, and Self-Host.
5
5
  Author-email: Mozilla Services <developers@kinto-storage.org>
6
6
  License: Copyright 2012 - Mozilla Foundation
@@ -34,45 +34,45 @@ License-File: LICENSE
34
34
  Requires-Dist: bcrypt
35
35
  Requires-Dist: colander
36
36
  Requires-Dist: cornice
37
- Requires-Dist: cornice-swagger
37
+ Requires-Dist: cornice_swagger
38
38
  Requires-Dist: dockerflow
39
39
  Requires-Dist: jsonschema
40
40
  Requires-Dist: jsonpatch
41
41
  Requires-Dist: logging-color-formatter
42
42
  Requires-Dist: python-dateutil
43
43
  Requires-Dist: pyramid
44
- Requires-Dist: pyramid-mailer
45
- Requires-Dist: pyramid-multiauth
44
+ Requires-Dist: pyramid_mailer
45
+ Requires-Dist: pyramid_multiauth
46
46
  Requires-Dist: transaction
47
- Requires-Dist: pyramid-tm
47
+ Requires-Dist: pyramid_tm
48
48
  Requires-Dist: requests
49
49
  Requires-Dist: waitress
50
50
  Requires-Dist: python-rapidjson
51
- Provides-Extra: dev
52
- Requires-Dist: build ; extra == 'dev'
53
- Requires-Dist: ruff ; extra == 'dev'
54
- Requires-Dist: twine ; extra == 'dev'
51
+ Provides-Extra: redis
52
+ Requires-Dist: kinto_redis; extra == "redis"
55
53
  Provides-Extra: memcached
56
- Requires-Dist: python-memcached ; extra == 'memcached'
57
- Provides-Extra: monitoring
58
- Requires-Dist: newrelic ; extra == 'monitoring'
59
- Requires-Dist: sentry-sdk[sqlalchemy] ; extra == 'monitoring'
60
- Requires-Dist: statsd ; extra == 'monitoring'
61
- Requires-Dist: werkzeug ; extra == 'monitoring'
62
- Requires-Dist: prometheus-client ; extra == 'monitoring'
54
+ Requires-Dist: python-memcached; extra == "memcached"
63
55
  Provides-Extra: postgresql
64
- Requires-Dist: SQLAlchemy <3 ; extra == 'postgresql'
65
- Requires-Dist: psycopg2 ; extra == 'postgresql'
66
- Requires-Dist: zope.sqlalchemy ; extra == 'postgresql'
67
- Provides-Extra: redis
68
- Requires-Dist: kinto-redis ; extra == 'redis'
56
+ Requires-Dist: SQLAlchemy<3; extra == "postgresql"
57
+ Requires-Dist: psycopg2; extra == "postgresql"
58
+ Requires-Dist: zope.sqlalchemy; extra == "postgresql"
59
+ Provides-Extra: monitoring
60
+ Requires-Dist: newrelic; extra == "monitoring"
61
+ Requires-Dist: sentry-sdk[sqlalchemy]; extra == "monitoring"
62
+ Requires-Dist: statsd; extra == "monitoring"
63
+ Requires-Dist: werkzeug; extra == "monitoring"
64
+ Requires-Dist: prometheus-client; extra == "monitoring"
69
65
  Provides-Extra: test
70
- Requires-Dist: bravado ; extra == 'test'
71
- Requires-Dist: pytest ; extra == 'test'
72
- Requires-Dist: pytest-cache ; extra == 'test'
73
- Requires-Dist: pytest-cov ; extra == 'test'
74
- Requires-Dist: playwright ; extra == 'test'
75
- Requires-Dist: webtest ; extra == 'test'
66
+ Requires-Dist: bravado; extra == "test"
67
+ Requires-Dist: pytest; extra == "test"
68
+ Requires-Dist: pytest-cache; extra == "test"
69
+ Requires-Dist: pytest-cov; extra == "test"
70
+ Requires-Dist: playwright; extra == "test"
71
+ Requires-Dist: webtest; extra == "test"
72
+ Provides-Extra: dev
73
+ Requires-Dist: build; extra == "dev"
74
+ Requires-Dist: ruff; extra == "dev"
75
+ Requires-Dist: twine; extra == "dev"
76
76
 
77
77
  Kinto
78
78
  =====
@@ -12,7 +12,7 @@ kinto/core/authorization.py,sha256=GywY25KEzuSSAI709dFHDfdLnKxy3SLEYGwW5FkQ7Qc,1
12
12
  kinto/core/decorators.py,sha256=3SAPWXlyPNUSICZ9mz04bcN-UdbnDuFOtU0bQHHzLis,2178
13
13
  kinto/core/errors.py,sha256=fxOLR4lImwHp26hhxxaqk6uW0U7v2Jb6f4sgAcRPRu8,8854
14
14
  kinto/core/events.py,sha256=SYpXgKMtVjiD9fwYJA2Omdom9yA3nBqi9btdvU1I_nc,10345
15
- kinto/core/initialization.py,sha256=EOHjcE0Y1qd20ewUb0yFjvEBpvdJPZA1sQMT-zHONp8,26594
15
+ kinto/core/initialization.py,sha256=pkpfIx1yznFELhXLttwBvO0iBIgPxSA8onisHDjG0kk,26682
16
16
  kinto/core/metrics.py,sha256=Y6Mt4PUzy2-oudeGr_oCmtX8nIR4SZkzUlPxr58jr-g,2619
17
17
  kinto/core/openapi.py,sha256=bPHRCVmdZsJCsKm8BId02Q2Wz8etF1xL7Z9rU9JDx5k,3855
18
18
  kinto/core/schema.py,sha256=d5L5TQynRYJPkZ8Mu2X7F72xEh6SKDbrHK1CNTdOf2E,3646
@@ -33,7 +33,7 @@ kinto/core/permission/testing.py,sha256=EcfqwkbqJuW3Bzx0QEYNq-Rbgu4AqvLDx90s79Lx
33
33
  kinto/core/permission/postgresql/__init__.py,sha256=546ut-LAdQ__eBhClAxj9Pc2oOkHfl2dBhJZSyIvDuI,18254
34
34
  kinto/core/permission/postgresql/schema.sql,sha256=BlKJNC-omDVF9REaWCTsfKgXupFrmCBX8ZvN4sqTWUU,1344
35
35
  kinto/core/permission/postgresql/migrations/migration_001_002.sql,sha256=ey5rDVQfStVStWpyTJn2fmQP5WSA34HhO99PapcgH1k,681
36
- kinto/core/resource/__init__.py,sha256=dVEW8wHpnjAIfqFGIE9P3o_Fy9ZmsZWMtTB_PjaTuWk,50657
36
+ kinto/core/resource/__init__.py,sha256=GPF3EjG_b4gvMMiqEpR0-tR9bcjuJFhO-WPKDD4FhpA,50749
37
37
  kinto/core/resource/model.py,sha256=xjZ6shnhelXCdWvgw6yeOWXodxiKMm9iyDqLTk0i8Bs,15626
38
38
  kinto/core/resource/schema.py,sha256=z5ZhuPcNydByinaSNwTHe0xXCgJvwQcVFwFT0YNSjaQ,16141
39
39
  kinto/core/resource/viewset.py,sha256=3Uck_7Fp1lIDunDoAU6yDzswBr3ZDSPn16sIckRHdko,7602
@@ -79,7 +79,7 @@ kinto/core/views/version.py,sha256=-m5G_o0oHTpCgrtfFrHFve6Zqw_gs_szT0Bd8jnNmD4,1
79
79
  kinto/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
80
  kinto/plugins/flush.py,sha256=HnKJ6-oDo-NMSjdZskqZ09aMnFM-LJHW9vIw4VIyvcI,812
81
81
  kinto/plugins/prometheus.py,sha256=tLxb1VZOzZS-8PJgqXDfjHz773wHtwZjcFZuE10-hbA,5486
82
- kinto/plugins/statsd.py,sha256=_b0wXepCsBnkCzH4GsRtGds2MwUXmZnwI-Y-awi6wVk,2235
82
+ kinto/plugins/statsd.py,sha256=-VasJZM1xkhTfFa6_0GgWwfPqKnYS2722bSMDLzZ3pI,2469
83
83
  kinto/plugins/accounts/__init__.py,sha256=LUyPfIWIn-HtpmyKO8wAxY9oFsgeYgbMHFmNOcns7rY,4365
84
84
  kinto/plugins/accounts/authentication.py,sha256=h7l_KezC8os4sKN1bz3RKEwXwYTYAs21DRzzU9na_U0,3742
85
85
  kinto/plugins/accounts/mails.py,sha256=vfb80INjDIJqC1JkPhcwGXlVWjvXhazxA_pnckmOOdo,3481
@@ -125,9 +125,9 @@ kinto/views/contribute.py,sha256=NEDr2g1HhVwcMBg0qHEZDmWVJ1V31WsM8cRs0Vm6hfc,118
125
125
  kinto/views/groups.py,sha256=jOq5fX0-4lwZE8k1q5HME2tU7x9052rtBPF7YqcJ-Qg,3181
126
126
  kinto/views/permissions.py,sha256=F0_eKx201WyLonXJ5vLdGKa9RcFKjvAihrEEhU1JuLw,9069
127
127
  kinto/views/records.py,sha256=lYfACW2L8qcQoyYBD5IX-fTPjFWmGp7GjHq_U4InlyE,5037
128
- kinto-19.3.0.dist-info/LICENSE,sha256=oNEIMTuTJzppR5ZEyi86yvvtSagveMYXTYFn56zF0Uk,561
129
- kinto-19.3.0.dist-info/METADATA,sha256=So9rRBLy7Q9zcbnOqCHpGPqUfGG8M9Am6xRe__cMEyg,8878
130
- kinto-19.3.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
131
- kinto-19.3.0.dist-info/entry_points.txt,sha256=3KlqBWPKY81mrCe_oX0I5s1cRO7Q53nCLbnVr5P9LH4,85
132
- kinto-19.3.0.dist-info/top_level.txt,sha256=EG_YmbZL6FAug9VwopG7JtF9SvH_r0DEnFp-3twPPys,6
133
- kinto-19.3.0.dist-info/RECORD,,
128
+ kinto-19.3.1.dist-info/LICENSE,sha256=oNEIMTuTJzppR5ZEyi86yvvtSagveMYXTYFn56zF0Uk,561
129
+ kinto-19.3.1.dist-info/METADATA,sha256=SYYPOi9T_o6UEeor1EtrJMCGDtaVaPBehNirDhYL-K4,8858
130
+ kinto-19.3.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
131
+ kinto-19.3.1.dist-info/entry_points.txt,sha256=3KlqBWPKY81mrCe_oX0I5s1cRO7Q53nCLbnVr5P9LH4,85
132
+ kinto-19.3.1.dist-info/top_level.txt,sha256=EG_YmbZL6FAug9VwopG7JtF9SvH_r0DEnFp-3twPPys,6
133
+ kinto-19.3.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5