c2cwsgiutils 5.0.1__py3-none-any.whl → 5.0.4__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.
- c2cwsgiutils/acceptance/composition.py +1 -1
- c2cwsgiutils/broadcast/redis.py +1 -1
- c2cwsgiutils/client_info.py +10 -0
- c2cwsgiutils/db.py +2 -2
- c2cwsgiutils/prometheus.py +1 -1
- c2cwsgiutils/pyramid_logging.py +1 -1
- c2cwsgiutils/redis_stats.py +1 -1
- c2cwsgiutils/redis_utils.py +1 -1
- c2cwsgiutils/request_tracking/__init__.py +1 -1
- c2cwsgiutils/sentry.py +1 -1
- c2cwsgiutils/sqlalchemylogger/handlers.py +1 -1
- c2cwsgiutils/stats.py +1 -1
- {c2cwsgiutils-5.0.1.dist-info → c2cwsgiutils-5.0.4.dist-info}/METADATA +8 -2
- {c2cwsgiutils-5.0.1.dist-info → c2cwsgiutils-5.0.4.dist-info}/RECORD +19 -19
- {c2cwsgiutils-5.0.1.dist-info → c2cwsgiutils-5.0.4.dist-info}/WHEEL +1 -1
- {c2cwsgiutils-5.0.1.data → c2cwsgiutils-5.0.4.data}/scripts/c2cwsgiutils-run +0 -0
- {c2cwsgiutils-5.0.1.dist-info → c2cwsgiutils-5.0.4.dist-info}/LICENSE.txt +0 -0
- {c2cwsgiutils-5.0.1.dist-info → c2cwsgiutils-5.0.4.dist-info}/entry_points.txt +0 -0
- {c2cwsgiutils-5.0.1.dist-info → c2cwsgiutils-5.0.4.dist-info}/top_level.txt +0 -0
@@ -24,7 +24,7 @@ def _try(what: Callable[[], Any], fail: bool = True, times: int = 5, delay: int
|
|
24
24
|
for i in range(times):
|
25
25
|
try:
|
26
26
|
return what()
|
27
|
-
except: # noqa: bare-except
|
27
|
+
except: # noqa: bare-except # pylint: disable=bare-except
|
28
28
|
LOG.warning("Exception:", exc_info=True)
|
29
29
|
if i + 1 == times and fail:
|
30
30
|
raise
|
c2cwsgiutils/broadcast/redis.py
CHANGED
c2cwsgiutils/client_info.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import os
|
1
2
|
import re
|
2
3
|
from typing import Any, Callable, Dict
|
3
4
|
|
@@ -22,6 +23,15 @@ class Filter:
|
|
22
23
|
else:
|
23
24
|
_handle_others(environ)
|
24
25
|
|
26
|
+
if "C2CWSGIUTILS_FORCE_PROTO" in os.environ:
|
27
|
+
environ["wsgi.url_scheme"] = os.environ["C2CWSGIUTILS_FORCE_PROTO"]
|
28
|
+
if "C2CWSGIUTILS_FORCE_HOST" in os.environ:
|
29
|
+
environ["HTTP_HOST"] = os.environ["C2CWSGIUTILS_FORCE_HOST"]
|
30
|
+
if "C2CWSGIUTILS_FORCE_SERVER_NAME" in os.environ:
|
31
|
+
environ["SERVER_NAME"] = os.environ["C2CWSGIUTILS_FORCE_SERVER_NAME"]
|
32
|
+
if "C2CWSGIUTILS_FORCE_REMOTE_ADDR" in os.environ:
|
33
|
+
environ["REMOTE_ADDR"] = os.environ["C2CWSGIUTILS_FORCE_REMOTE_ADDR"]
|
34
|
+
|
25
35
|
return self._application(environ, start_response)
|
26
36
|
|
27
37
|
|
c2cwsgiutils/db.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import logging
|
3
3
|
import re
|
4
4
|
import warnings
|
5
|
-
from typing import Pattern # noqa
|
5
|
+
from typing import Pattern # noqa
|
6
6
|
from typing import Any, Callable, Iterable, Optional, Tuple, Union, cast
|
7
7
|
|
8
8
|
import pyramid.config
|
@@ -190,7 +190,7 @@ def _add_tween(
|
|
190
190
|
|
191
191
|
return db_chooser_tween
|
192
192
|
|
193
|
-
tweens.__setattr__(name, db_chooser_tween_factory)
|
193
|
+
tweens.__setattr__(name, db_chooser_tween_factory) # pylint: disable=unnecessary-dunder-call
|
194
194
|
config.add_tween("c2cwsgiutils.db.tweens." + name, over="pyramid_tm.tm_tween_factory")
|
195
195
|
|
196
196
|
|
c2cwsgiutils/prometheus.py
CHANGED
c2cwsgiutils/pyramid_logging.py
CHANGED
@@ -101,7 +101,7 @@ class PyramidCeeSysLogHandler(cee_syslog_handler.CeeSysLogHandler): # type: ign
|
|
101
101
|
|
102
102
|
|
103
103
|
if TYPE_CHECKING:
|
104
|
-
Base = logging.StreamHandler[IO[str]]
|
104
|
+
Base = logging.StreamHandler[IO[str]]
|
105
105
|
else:
|
106
106
|
Base = logging.StreamHandler
|
107
107
|
|
c2cwsgiutils/redis_stats.py
CHANGED
c2cwsgiutils/redis_utils.py
CHANGED
@@ -83,7 +83,7 @@ def _init(settings: Optional[Mapping[str, Any]]) -> None:
|
|
83
83
|
print(_sentinel.sentinels[0].sentinel_masters())
|
84
84
|
raise Exception(_sentinel.sentinels[0].sentinel_masters()) from error
|
85
85
|
if url:
|
86
|
-
if not url
|
86
|
+
if "://" not in url:
|
87
87
|
url = "redis://" + url
|
88
88
|
|
89
89
|
LOG.info("Redis setup using: %s, with options: %s", url, redis_options_)
|
@@ -7,7 +7,7 @@ import logging
|
|
7
7
|
import urllib.parse
|
8
8
|
import uuid
|
9
9
|
import warnings
|
10
|
-
from typing import Any, Dict, List, Optional, Sequence # noqa
|
10
|
+
from typing import Any, Dict, List, Optional, Sequence # noqa
|
11
11
|
|
12
12
|
import pyramid.request
|
13
13
|
import requests.adapters
|
c2cwsgiutils/sentry.py
CHANGED
@@ -2,7 +2,7 @@ import contextlib
|
|
2
2
|
import logging
|
3
3
|
import os
|
4
4
|
import warnings
|
5
|
-
from typing import Any, Callable, Generator, MutableMapping, Optional # noqa
|
5
|
+
from typing import Any, Callable, Generator, MutableMapping, Optional # noqa
|
6
6
|
|
7
7
|
import pyramid.config
|
8
8
|
import sentry_sdk
|
c2cwsgiutils/stats.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: c2cwsgiutils
|
3
|
-
Version: 5.0.
|
3
|
+
Version: 5.0.4
|
4
4
|
Summary: Common utilities for Camptocamp WSGI applications
|
5
5
|
Home-page: https://github.com/camptocamp/c2cwsgiutils
|
6
6
|
Author: Camptocamp
|
@@ -48,7 +48,6 @@ Requires-Dist: zope.sqlalchemy ; extra == 'standard'
|
|
48
48
|
Requires-Dist: pyyaml ; extra == 'standard'
|
49
49
|
Requires-Dist: pyjwt ; extra == 'standard'
|
50
50
|
Requires-Dist: requests-oauthlib ; extra == 'standard'
|
51
|
-
Requires-Dist: setuptools ; extra == 'standard'
|
52
51
|
Requires-Dist: waitress ; extra == 'standard'
|
53
52
|
Requires-Dist: certifi ; extra == 'standard'
|
54
53
|
Requires-Dist: charset-normalizer ; extra == 'standard'
|
@@ -745,3 +744,10 @@ To make a release:
|
|
745
744
|
- Tag the GIT commit.
|
746
745
|
- Add the new branch name in the `.github/workflows/rebuild.yaml` and
|
747
746
|
`.github/workflows/audit.yaml` files.
|
747
|
+
|
748
|
+
## Pserve
|
749
|
+
|
750
|
+
Pserve will not set the headers in the environment then if you are behind a reverse proxy, you will have
|
751
|
+
wrong values in client information, you can force them by using the environment variables:
|
752
|
+
`C2CWSGIUTILS_FORCE_PROTO`, `C2CWSGIUTILS_FORCE_HOST` `C2CWSGIUTILS_FORCE_SERVER_NAME` and
|
753
|
+
`C2CWSGIUTILS_FORCE_REMOTE_ADDR`.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
c2cwsgiutils/__init__.py,sha256=GAp4F7ZzG07CJKSO64i0JUlCMQklx2OGRZgDbU4rFiY,803
|
2
2
|
c2cwsgiutils/auth.py,sha256=KG-J0usHVpVw0Tz7LUOdhsF2gjMF-6S_w5Fmvg1rDro,6487
|
3
|
-
c2cwsgiutils/client_info.py,sha256=
|
3
|
+
c2cwsgiutils/client_info.py,sha256=YFteIwNamIc3LIsaYv2C1MZRS6crJYoId5TgxYNvDSw,3601
|
4
4
|
c2cwsgiutils/config_utils.py,sha256=aN_New-YukyZ08--z2CsjTSS6YfDsI5pc_ciNewjxS0,1496
|
5
5
|
c2cwsgiutils/coverage_setup.py,sha256=jg_SAgEZnOqbZvbenyES6ReO3bRS8YyNM3qUzjpch6I,839
|
6
|
-
c2cwsgiutils/db.py,sha256=
|
6
|
+
c2cwsgiutils/db.py,sha256=q8kAxzA36cR1W-QtPcXagWSwDbCoDJhoQ12QckpdQQ8,15325
|
7
7
|
c2cwsgiutils/db_maintenance_view.py,sha256=Br9EnG4wfFCh5-vWGY86be9iCQmS8Z3dg-n0F0Qp_wc,3049
|
8
8
|
c2cwsgiutils/errors.py,sha256=XlWZOA20bfog1l6vg0mHzgmpCI7zK6qQ5qPVxPhk6FI,6670
|
9
9
|
c2cwsgiutils/health_check.py,sha256=JCHm1GLus5dQiKblKpk6jpg4WpIqxCku63eKFl-VTXE,20317
|
@@ -14,32 +14,32 @@ c2cwsgiutils/metrics.py,sha256=6Fx6ZjVuy40X5pLLlgflgd1hQYTCxm2OMweyXvLEUUI,3425
|
|
14
14
|
c2cwsgiutils/models_graph.py,sha256=jqw3Ua0sMUhi1Kp4AwiqwuwpB8JYqEEUVaUmicO1HIc,2653
|
15
15
|
c2cwsgiutils/pretty_json.py,sha256=sNRRSRtdOm6EzkBJgGbA4gBHuqsLMjq6U5mYabi_eT0,1441
|
16
16
|
c2cwsgiutils/profiler.py,sha256=6eSg-_WJKPOQ07rmfVsrfD3lUfbniJoXukkNRUY9PB0,1316
|
17
|
-
c2cwsgiutils/prometheus.py,sha256=
|
17
|
+
c2cwsgiutils/prometheus.py,sha256=lsREO4k0nJujIQIeHwmPabMycZQwghBhJo425wpH2tY,2070
|
18
18
|
c2cwsgiutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
c2cwsgiutils/pyramid.py,sha256=VmrAMFpC636WTToNNaI9hWQOYJAk5hn__K43mBvUFtw,1346
|
20
|
-
c2cwsgiutils/pyramid_logging.py,sha256=
|
21
|
-
c2cwsgiutils/redis_stats.py,sha256=
|
22
|
-
c2cwsgiutils/redis_utils.py,sha256=
|
23
|
-
c2cwsgiutils/sentry.py,sha256=
|
20
|
+
c2cwsgiutils/pyramid_logging.py,sha256=8_67MGoSdq_5OUGns63f4FfWjYcRCM1GzQAxIqEg45c,3674
|
21
|
+
c2cwsgiutils/redis_stats.py,sha256=pIQTJRRWPRPTX5ch605dIDPkJVwVY2GRMQcvelWVs1E,1487
|
22
|
+
c2cwsgiutils/redis_utils.py,sha256=j8uhxaLOTpxnPQPorrxG3SFrQNebxmMlIioZY0rXDWg,4746
|
23
|
+
c2cwsgiutils/sentry.py,sha256=iAs6MhdoRU5LPf4rbmgRfs9JCqhojrk-OGdgjAu86QI,5010
|
24
24
|
c2cwsgiutils/services.py,sha256=Qajsjrxcasieed2_W3AGCYpmQOrKxAqSK5s5o-UScPo,1559
|
25
25
|
c2cwsgiutils/setup_process.py,sha256=z5pd4Ry13_IA-vXdILQmro2VZI2X9tCyT_sj2vHwXVw,2825
|
26
|
-
c2cwsgiutils/stats.py,sha256=
|
26
|
+
c2cwsgiutils/stats.py,sha256=_4BKFDCeyOOQHRvMu4PGqBWwkybqlbQl7SCA27WpRdc,11525
|
27
27
|
c2cwsgiutils/version.py,sha256=ddTMRafXaPF4LyPZz50PjoqmT34lclLSH1_EHVbTnoU,1818
|
28
28
|
c2cwsgiutils/acceptance/__init__.py,sha256=vjtpPfu0kbXUOYMx15Z8713IfPFZA9XnkUKkIFtVj_M,1500
|
29
|
-
c2cwsgiutils/acceptance/composition.py,sha256=
|
29
|
+
c2cwsgiutils/acceptance/composition.py,sha256=APDMwsehzqsLz-D5B-YVd3Ie3rzkZmhxl5cBvAxVCRQ,4640
|
30
30
|
c2cwsgiutils/acceptance/connection.py,sha256=CDx6rYmHpUAhKMgeV94ZNONMj9BuaRglJhS0PvRlUc0,9053
|
31
31
|
c2cwsgiutils/acceptance/print.py,sha256=0sO_QvdwzFrtOHXlq0BjGXM_0c-lUCcrCo-PU_oHH40,2328
|
32
32
|
c2cwsgiutils/acceptance/utils.py,sha256=cmuV8Kig9KEvFZzQViYzwO-0NfsQU8cAaReL-higBDk,2077
|
33
33
|
c2cwsgiutils/broadcast/__init__.py,sha256=cAODXqq2pwZp0n92QSi0ybJIQttV2CJwc1Cd1hhpEvQ,4160
|
34
34
|
c2cwsgiutils/broadcast/interface.py,sha256=M2NMNCXky05xA_jVlnkEcRG-3SE0TEA2uXTz0oR4zKs,615
|
35
35
|
c2cwsgiutils/broadcast/local.py,sha256=iJxv9IjzKjKYz6ZLXRSbrqGRmNUmGoYsSbcRSdz4dbs,1062
|
36
|
-
c2cwsgiutils/broadcast/redis.py,sha256=
|
36
|
+
c2cwsgiutils/broadcast/redis.py,sha256=BW-4psoyPncNJfQgk81l1M0EFyiCqyHP8HbwWxNtyfo,5056
|
37
37
|
c2cwsgiutils/broadcast/utils.py,sha256=0fQZXPu3p_5LEJpGenJwiiMxECQjJhjZBjIkBk8h-ng,272
|
38
38
|
c2cwsgiutils/debug/__init__.py,sha256=80zdAZnE9cwgQW1odE2aOauIxYsG5CQpWvHPcslRue8,1239
|
39
39
|
c2cwsgiutils/debug/_listeners.py,sha256=2YQvC5phYSwcIB44p5gJ_-CTBz0HoDivXvX7PVaOIFg,4358
|
40
40
|
c2cwsgiutils/debug/_views.py,sha256=0SQ-fdq8VFxItKAtJ8y0OrdnxoEIeDC6dmnAhQ9Wjrk,7506
|
41
41
|
c2cwsgiutils/debug/utils.py,sha256=1vtfXND_hzs6PH8ohnRGcPYaW2_qKRJ6VxDvEdG0hdU,2328
|
42
|
-
c2cwsgiutils/request_tracking/__init__.py,sha256=
|
42
|
+
c2cwsgiutils/request_tracking/__init__.py,sha256=y5SKpcnpr3e7lRnY8hr6_XOarmn42t14B2J3ZZMIjh0,3820
|
43
43
|
c2cwsgiutils/request_tracking/_sql.py,sha256=OQQhhkOK4lpYIeOwBocPu1a-IHGf8OTVeR8nYySJsCA,538
|
44
44
|
c2cwsgiutils/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
45
|
c2cwsgiutils/scripts/check_es.py,sha256=dXF1FpyyIUMRlDxA-OY4RjOdnNqxYq2F6IhoNM7nRPg,4147
|
@@ -52,17 +52,17 @@ c2cwsgiutils/sql_profiler/_impl.py,sha256=ohH42gQ1VBeUj4ggff6vT3JwQohrDvSvqQLGCR
|
|
52
52
|
c2cwsgiutils/sqlalchemylogger/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
53
|
c2cwsgiutils/sqlalchemylogger/_filters.py,sha256=OJQ9_WA-fd9fMZ7TUNFzHHTPI6msw2NVBl5RoeYFnGw,752
|
54
54
|
c2cwsgiutils/sqlalchemylogger/_models.py,sha256=aHzaVA05kPNa2B_s5kLtEMCTLmr9TgH3Gv2PzVYGhxo,1422
|
55
|
-
c2cwsgiutils/sqlalchemylogger/handlers.py,sha256=
|
55
|
+
c2cwsgiutils/sqlalchemylogger/handlers.py,sha256=UQ-vfUzMlzvtFoKxVWCkm1wdI_PcYqktGKksSpiXe2E,4686
|
56
56
|
c2cwsgiutils/stats_pyramid/__init__.py,sha256=Vxncq4iRCIlrPjiugQVARqg3VjAMK5H3iMXpWO3NISo,971
|
57
57
|
c2cwsgiutils/stats_pyramid/_db_spy.py,sha256=qTQ7xkvE6TN6mcOUhcPpOQBJla-yNY08lV05OZdjGkA,2841
|
58
58
|
c2cwsgiutils/stats_pyramid/_pyramid_spy.py,sha256=tDm3Y-kRVp1Y_jEaz1bFlWHCeXkHMAogOKE6qN-rO08,2886
|
59
59
|
c2cwsgiutils/stats_pyramid/_views.py,sha256=c3PfyrXzG6I184-bWUrHpR1bt3xyIMgs5mfcZ6NjEwU,527
|
60
|
-
c2cwsgiutils-5.0.
|
60
|
+
c2cwsgiutils-5.0.4.data/scripts/c2cwsgiutils-run,sha256=q738ALYHJIJq9wOhvIbZruZDegQcClfYm9GEq4y4qYU,579
|
61
61
|
tests/acceptance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
62
62
|
tests/acceptance/test_utils.py,sha256=_4GDX0Lx5bAUJq5WRm0aj-nTllIXDcmo3bqRrbAgs20,380
|
63
|
-
c2cwsgiutils-5.0.
|
64
|
-
c2cwsgiutils-5.0.
|
65
|
-
c2cwsgiutils-5.0.
|
66
|
-
c2cwsgiutils-5.0.
|
67
|
-
c2cwsgiutils-5.0.
|
68
|
-
c2cwsgiutils-5.0.
|
63
|
+
c2cwsgiutils-5.0.4.dist-info/LICENSE.txt,sha256=PQNFSY2-jzHIwQ_UxvzxLVY5yLryW_lVLHVgUCvtKos,1668
|
64
|
+
c2cwsgiutils-5.0.4.dist-info/METADATA,sha256=jCbLiI1Mmm9_JFWZwxmYhqlyR6kuOh1nC-kv1KTBBE0,31908
|
65
|
+
c2cwsgiutils-5.0.4.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
|
66
|
+
c2cwsgiutils-5.0.4.dist-info/entry_points.txt,sha256=Be1vjq5sdITjO6XLdVDIwxii-UoYZcVlQoJ2la0yntk,1138
|
67
|
+
c2cwsgiutils-5.0.4.dist-info/top_level.txt,sha256=U2UMa3vcTM_6GxZe2f8KeOi-8gIcUruUnmhVSZZ27BI,19
|
68
|
+
c2cwsgiutils-5.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|