c2cwsgiutils 6.2.0.dev378__py3-none-any.whl → 6.2.0.dev381__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.
@@ -10,6 +10,7 @@ or create a new logger by calling the `logging.getlogger` method.
10
10
  import logging
11
11
  from c2cwsgiutils.sqlalchemylogger.handlers import SQLAlchemyHandler
12
12
 
13
+
13
14
  def _setup_sqlalchemy_logger():
14
15
  """
15
16
  Setup sqlalchemy logger.
@@ -26,8 +27,11 @@ def _setup_sqlalchemy_logger():
26
27
  )
27
28
  logger.addHandler(handler)
28
29
 
30
+
29
31
  def main(_, **settings):
30
- _setup_sqlalchemy_logger ()
32
+ _setup_sqlalchemy_logger()
33
+
34
+
31
35
  ...
32
36
  ```
33
37
 
@@ -49,16 +53,16 @@ import time
49
53
 
50
54
  from c2cwsgiutils.sqlalchemylogger.handlers import SQLAlchemyHandler
51
55
 
52
- if __name__ == '__main__':
56
+ if __name__ == "__main__":
53
57
  logging.basicConfig(
54
- format='%(asctime)s : %(name)s : %(levelname)s : %(message)s',
58
+ format="%(asctime)s : %(name)s : %(levelname)s : %(message)s",
55
59
  level=logging.DEBUG,
56
60
  )
57
61
  logger = logging.getLogger(__name__)
58
- logger_db_engine = {'url':'sqlite:///logger_db.sqlite3'}
62
+ logger_db_engine = {"url": "sqlite:///logger_db.sqlite3"}
59
63
 
60
64
  logger.addHandler(SQLAlchemyHandler(logger_db_engine))
61
- logger.info('bla')
65
+ logger.info("bla")
62
66
  # wait a few seconds because the second thread will write the
63
67
  # logs after a timeout
64
68
  time.sleep(2)
@@ -84,7 +88,8 @@ propagate = 0
84
88
  ```python
85
89
  def post_fork(server, worker):
86
90
  import logging
87
- logger = logging.getHandlerByName('sqlalchemylogger')
91
+
92
+ logger = logging.getHandlerByName("sqlalchemylogger")
88
93
  logger.start()
89
94
  ```
90
95
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: c2cwsgiutils
3
- Version: 6.2.0.dev378
3
+ Version: 6.2.0.dev381
4
4
  Summary: Common utilities for Camptocamp WSGI applications
5
5
  License-Expression: BSD-2-Clause
6
6
  License-File: LICENSE
@@ -317,6 +317,7 @@ To enable most of the features of c2cwsgiutils, you need to add this line to you
317
317
 
318
318
  ```python
319
319
  import c2cwsgiutils.pyramid
320
+
320
321
  config.include(c2cwsgiutils.pyramid.includeme)
321
322
  ```
322
323
 
@@ -413,7 +414,7 @@ Or with the `with` statement:
413
414
  ```python
414
415
  from c2cwsgiutils.profile import Profiler
415
416
 
416
- with Profile('/my_file.prof'):
417
+ with Profile("/my_file.prof"):
417
418
  ...
418
419
  ```
419
420
 
@@ -450,10 +451,9 @@ And your code that initializes the DB connection must look like that:
450
451
  ```python
451
452
  import c2cwsgiutils.db
452
453
 
454
+
453
455
  def main(config):
454
- c2cwsgiutils.db.init(config, 'sqlalchemy', 'sqlalchemy_slave', force_slave=[
455
- "POST /api/hello"
456
- ])[0]
456
+ c2cwsgiutils.db.init(config, "sqlalchemy", "sqlalchemy_slave", force_slave=["POST /api/hello"])[0]
457
457
  ```
458
458
 
459
459
  You can use the `force_slave` and `force_master` parameters to override the defaults and force a route to use
@@ -467,17 +467,19 @@ setup). For example:
467
467
  ```python
468
468
  from c2cwsgiutils.health_check import HealthCheck
469
469
 
470
+
470
471
  def custom_check(request):
471
472
  global not_happy
472
473
  if not_happy:
473
474
  raise Exception("I'm not happy")
474
475
  return "happy"
475
476
 
477
+
476
478
  health_check = HealthCheck(config)
477
479
  health_check.add_db_session_check(models.DBSession, at_least_one_model=models.Hello)
478
- health_check.add_url_check('http://localhost:8080/api/hello')
479
- health_check.add_custom_check('custom', custom_check, 2)
480
- health_check.add_alembic_check(models.DBSession, '/app/alembic.ini', 3)
480
+ health_check.add_url_check("http://localhost:8080/api/hello")
481
+ health_check.add_custom_check("custom", custom_check, 2)
482
+ health_check.add_alembic_check(models.DBSession, "/app/alembic.ini", 3)
481
483
  ```
482
484
 
483
485
  Then, the URL `{C2C_BASE_PATH}/health_check?max_level=3` can be used to run the health checks and get a report
@@ -718,11 +720,13 @@ To have CORS compliant views, define your views like that:
718
720
 
719
721
  ```python
720
722
  from c2cwsgiutils import services
723
+
721
724
  hello_service = services.create("hello", "/hello", cors_credentials=True)
722
725
 
726
+
723
727
  @hello_service.get()
724
728
  def hello_get(request):
725
- return {'hello': True}
729
+ return {"hello": True}
726
730
  ```
727
731
 
728
732
  ## Waitress
@@ -906,6 +910,7 @@ To do the image test call `check_screenshot` e.g.:
906
910
  ```python
907
911
  from c2cwsgiutils.acceptance import image
908
912
 
913
+
909
914
  def test_screenshot(app_connection):
910
915
  image.check_screenshot(
911
916
  app_connection.base_url + "my-path",
@@ -47,7 +47,7 @@ c2cwsgiutils/services.py,sha256=ZgJcFpZHog7Cg998c8xYxDrYKNZJxSvOT8K3bhCKwbc,1606
47
47
  c2cwsgiutils/setup_process.py,sha256=BDHCPegT2pIYVfmXeqP0jByNl3R_bs3htLwLMhlqHMU,3624
48
48
  c2cwsgiutils/sql_profiler/__init__.py,sha256=NeKXxNxSpLaIp-1FaddBejzMEubdQ9dnqtfddq027Ls,958
49
49
  c2cwsgiutils/sql_profiler/_impl.py,sha256=8-YtSQjPKL6RVTiHtcNtT9kESwoQj5Pw5bw-YnSPLc0,3801
50
- c2cwsgiutils/sqlalchemylogger/README.md,sha256=4nfSo_aLOHtt8UgPZrbRy65_-reG3-SugvwdGvcQPM0,2672
50
+ c2cwsgiutils/sqlalchemylogger/README.md,sha256=6mIQ5jjAPmhpEqnRC7K8WzDhSyoSpvrttTPL5FVI7ao,2678
51
51
  c2cwsgiutils/sqlalchemylogger/__init__.py,sha256=pkqbKuATfEJFGtJhN7Al_pCqPeSKFJh55pqW94LU6X0,36
52
52
  c2cwsgiutils/sqlalchemylogger/_filters.py,sha256=cxAXd9Wa8Wa_aKrubEWRoeDrfC_jNaH0-Dt1DSWL18c,789
53
53
  c2cwsgiutils/sqlalchemylogger/_models.py,sha256=m3qjET5iovifeUkgTuBzEWyDGCg__Os0UcpJ5J26F5E,1512
@@ -61,8 +61,8 @@ c2cwsgiutils/stats_pyramid/_db_spy.py,sha256=HV9tEFCkOhcBS-U1_DicLe3y3TGAVc_sxEt
61
61
  c2cwsgiutils/stats_pyramid/_pyramid_spy.py,sha256=GeV7a_AKDjcToIVpju4T3KBI64yCG6IWw_6nw_IAlFM,3535
62
62
  c2cwsgiutils/templates/index.html.mako,sha256=e54pfSL0nGRsnJkahFRLevNyUhvlCNb_2uVaO8rDhbg,1416
63
63
  c2cwsgiutils/version.py,sha256=3youfhXNIwZXuOqjDMUua2njF0cQS75FCuW1AMCldgs,3193
64
- c2cwsgiutils-6.2.0.dev378.dist-info/METADATA,sha256=h1QvurmK5smku3Sj9JL2hb1vrT0aL2PzheG8agKnVqE,37533
65
- c2cwsgiutils-6.2.0.dev378.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
66
- c2cwsgiutils-6.2.0.dev378.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
67
- c2cwsgiutils-6.2.0.dev378.dist-info/licenses/LICENSE,sha256=hCNci_ppSy6SKe_nTdgzjCsTIaNQgAKqDSghWn_G-1I,1304
68
- c2cwsgiutils-6.2.0.dev378.dist-info/RECORD,,
64
+ c2cwsgiutils-6.2.0.dev381.dist-info/METADATA,sha256=_PhdvGJea2EKkAHrQnd8Z6R-PEcqiqvsgBpZO7JYxYA,37526
65
+ c2cwsgiutils-6.2.0.dev381.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
66
+ c2cwsgiutils-6.2.0.dev381.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
67
+ c2cwsgiutils-6.2.0.dev381.dist-info/licenses/LICENSE,sha256=hCNci_ppSy6SKe_nTdgzjCsTIaNQgAKqDSghWn_G-1I,1304
68
+ c2cwsgiutils-6.2.0.dev381.dist-info/RECORD,,