Added some logs
This commit is contained in:
parent
552db2aa8a
commit
a8322d6be0
8 changed files with 140 additions and 72 deletions
100
poetry.lock
generated
100
poetry.lock
generated
|
@ -167,33 +167,33 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "black"
|
name = "black"
|
||||||
version = "24.1.1"
|
version = "24.2.0"
|
||||||
description = "The uncompromising code formatter."
|
description = "The uncompromising code formatter."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "black-24.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2588021038bd5ada078de606f2a804cadd0a3cc6a79cb3e9bb3a8bf581325a4c"},
|
{file = "black-24.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6981eae48b3b33399c8757036c7f5d48a535b962a7c2310d19361edeef64ce29"},
|
||||||
{file = "black-24.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1a95915c98d6e32ca43809d46d932e2abc5f1f7d582ffbe65a5b4d1588af7445"},
|
{file = "black-24.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d533d5e3259720fdbc1b37444491b024003e012c5173f7d06825a77508085430"},
|
||||||
{file = "black-24.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fa6a0e965779c8f2afb286f9ef798df770ba2b6cee063c650b96adec22c056a"},
|
{file = "black-24.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61a0391772490ddfb8a693c067df1ef5227257e72b0e4108482b8d41b5aee13f"},
|
||||||
{file = "black-24.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:5242ecd9e990aeb995b6d03dc3b2d112d4a78f2083e5a8e86d566340ae80fec4"},
|
{file = "black-24.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:992e451b04667116680cb88f63449267c13e1ad134f30087dec8527242e9862a"},
|
||||||
{file = "black-24.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fc1ec9aa6f4d98d022101e015261c056ddebe3da6a8ccfc2c792cbe0349d48b7"},
|
{file = "black-24.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:163baf4ef40e6897a2a9b83890e59141cc8c2a98f2dda5080dc15c00ee1e62cd"},
|
||||||
{file = "black-24.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0269dfdea12442022e88043d2910429bed717b2d04523867a85dacce535916b8"},
|
{file = "black-24.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e37c99f89929af50ffaf912454b3e3b47fd64109659026b678c091a4cd450fb2"},
|
||||||
{file = "black-24.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3d64db762eae4a5ce04b6e3dd745dcca0fb9560eb931a5be97472e38652a161"},
|
{file = "black-24.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9de21bafcba9683853f6c96c2d515e364aee631b178eaa5145fc1c61a3cc92"},
|
||||||
{file = "black-24.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:5d7b06ea8816cbd4becfe5f70accae953c53c0e53aa98730ceccb0395520ee5d"},
|
{file = "black-24.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:9db528bccb9e8e20c08e716b3b09c6bdd64da0dd129b11e160bf082d4642ac23"},
|
||||||
{file = "black-24.1.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e2c8dfa14677f90d976f68e0c923947ae68fa3961d61ee30976c388adc0b02c8"},
|
{file = "black-24.2.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d84f29eb3ee44859052073b7636533ec995bd0f64e2fb43aeceefc70090e752b"},
|
||||||
{file = "black-24.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a21725862d0e855ae05da1dd25e3825ed712eaaccef6b03017fe0853a01aa45e"},
|
{file = "black-24.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e08fb9a15c914b81dd734ddd7fb10513016e5ce7e6704bdd5e1251ceee51ac9"},
|
||||||
{file = "black-24.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07204d078e25327aad9ed2c64790d681238686bce254c910de640c7cc4fc3aa6"},
|
{file = "black-24.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:810d445ae6069ce64030c78ff6127cd9cd178a9ac3361435708b907d8a04c693"},
|
||||||
{file = "black-24.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:a83fe522d9698d8f9a101b860b1ee154c1d25f8a82ceb807d319f085b2627c5b"},
|
{file = "black-24.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:ba15742a13de85e9b8f3239c8f807723991fbfae24bad92d34a2b12e81904982"},
|
||||||
{file = "black-24.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:08b34e85170d368c37ca7bf81cf67ac863c9d1963b2c1780c39102187ec8dd62"},
|
{file = "black-24.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7e53a8c630f71db01b28cd9602a1ada68c937cbf2c333e6ed041390d6968faf4"},
|
||||||
{file = "black-24.1.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7258c27115c1e3b5de9ac6c4f9957e3ee2c02c0b39222a24dc7aa03ba0e986f5"},
|
{file = "black-24.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93601c2deb321b4bad8f95df408e3fb3943d85012dddb6121336b8e24a0d1218"},
|
||||||
{file = "black-24.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40657e1b78212d582a0edecafef133cf1dd02e6677f539b669db4746150d38f6"},
|
{file = "black-24.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a0057f800de6acc4407fe75bb147b0c2b5cbb7c3ed110d3e5999cd01184d53b0"},
|
||||||
{file = "black-24.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e298d588744efda02379521a19639ebcd314fba7a49be22136204d7ed1782717"},
|
{file = "black-24.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:faf2ee02e6612577ba0181f4347bcbcf591eb122f7841ae5ba233d12c39dcb4d"},
|
||||||
{file = "black-24.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:34afe9da5056aa123b8bfda1664bfe6fb4e9c6f311d8e4a6eb089da9a9173bf9"},
|
{file = "black-24.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:057c3dc602eaa6fdc451069bd027a1b2635028b575a6c3acfd63193ced20d9c8"},
|
||||||
{file = "black-24.1.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:854c06fb86fd854140f37fb24dbf10621f5dab9e3b0c29a690ba595e3d543024"},
|
{file = "black-24.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:08654d0797e65f2423f850fc8e16a0ce50925f9337fb4a4a176a7aa4026e63f8"},
|
||||||
{file = "black-24.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3897ae5a21ca132efa219c029cce5e6bfc9c3d34ed7e892113d199c0b1b444a2"},
|
{file = "black-24.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca610d29415ee1a30a3f30fab7a8f4144e9d34c89a235d81292a1edb2b55f540"},
|
||||||
{file = "black-24.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:ecba2a15dfb2d97105be74bbfe5128bc5e9fa8477d8c46766505c1dda5883aac"},
|
{file = "black-24.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:4dd76e9468d5536abd40ffbc7a247f83b2324f0c050556d9c371c2b9a9a95e31"},
|
||||||
{file = "black-24.1.1-py3-none-any.whl", hash = "sha256:5cdc2e2195212208fbcae579b931407c1fa9997584f0a415421748aeafff1168"},
|
{file = "black-24.2.0-py3-none-any.whl", hash = "sha256:e8a6ae970537e67830776488bca52000eaa37fa63b9988e8c487458d9cd5ace6"},
|
||||||
{file = "black-24.1.1.tar.gz", hash = "sha256:48b5760dcbfe5cf97fd4fba23946681f3a81514c6ab8a45b50da67ac8fbc6c7b"},
|
{file = "black-24.2.0.tar.gz", hash = "sha256:bce4f25c27c3435e4dace4815bcb2008b87e167e3bf4ee47ccdc5ce906eb4894"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
|
@ -954,13 +954,13 @@ all = ["pendulum (>=3.0.0,<4.0.0)", "phonenumbers (>=8,<9)", "pycountry (>=23,<2
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pytest"
|
name = "pytest"
|
||||||
version = "8.0.0"
|
version = "8.0.1"
|
||||||
description = "pytest: simple powerful testing with Python"
|
description = "pytest: simple powerful testing with Python"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "pytest-8.0.0-py3-none-any.whl", hash = "sha256:50fb9cbe836c3f20f0dfa99c565201fb75dc54c8d76373cd1bde06b06657bdb6"},
|
{file = "pytest-8.0.1-py3-none-any.whl", hash = "sha256:3e4f16fe1c0a9dc9d9389161c127c3edc5d810c38d6793042fb81d9f48a59fca"},
|
||||||
{file = "pytest-8.0.0.tar.gz", hash = "sha256:249b1b0864530ba251b7438274c4d251c58d868edaaec8762893ad4a0d71c36c"},
|
{file = "pytest-8.0.1.tar.gz", hash = "sha256:267f6563751877d772019b13aacbe4e860d73fe8f651f28112e9ac37de7513ae"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
|
@ -1133,28 +1133,28 @@ files = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruff"
|
name = "ruff"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
description = "An extremely fast Python linter and code formatter, written in Rust."
|
description = "An extremely fast Python linter and code formatter, written in Rust."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "ruff-0.2.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:dd81b911d28925e7e8b323e8d06951554655021df8dd4ac3045d7212ac4ba080"},
|
{file = "ruff-0.2.2-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0a9efb032855ffb3c21f6405751d5e147b0c6b631e3ca3f6b20f917572b97eb6"},
|
||||||
{file = "ruff-0.2.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:dc586724a95b7d980aa17f671e173df00f0a2eef23f8babbeee663229a938fec"},
|
{file = "ruff-0.2.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:d450b7fbff85913f866a5384d8912710936e2b96da74541c82c1b458472ddb39"},
|
||||||
{file = "ruff-0.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c92db7101ef5bfc18e96777ed7bc7c822d545fa5977e90a585accac43d22f18a"},
|
{file = "ruff-0.2.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ecd46e3106850a5c26aee114e562c329f9a1fbe9e4821b008c4404f64ff9ce73"},
|
||||||
{file = "ruff-0.2.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:13471684694d41ae0f1e8e3a7497e14cd57ccb7dd72ae08d56a159d6c9c3e30e"},
|
{file = "ruff-0.2.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5e22676a5b875bd72acd3d11d5fa9075d3a5f53b877fe7b4793e4673499318ba"},
|
||||||
{file = "ruff-0.2.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a11567e20ea39d1f51aebd778685582d4c56ccb082c1161ffc10f79bebe6df35"},
|
{file = "ruff-0.2.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1695700d1e25a99d28f7a1636d85bafcc5030bba9d0578c0781ba1790dbcf51c"},
|
||||||
{file = "ruff-0.2.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:00a818e2db63659570403e44383ab03c529c2b9678ba4ba6c105af7854008105"},
|
{file = "ruff-0.2.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:b0c232af3d0bd8f521806223723456ffebf8e323bd1e4e82b0befb20ba18388e"},
|
||||||
{file = "ruff-0.2.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:be60592f9d218b52f03384d1325efa9d3b41e4c4d55ea022cd548547cc42cd2b"},
|
{file = "ruff-0.2.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f63d96494eeec2fc70d909393bcd76c69f35334cdbd9e20d089fb3f0640216ca"},
|
||||||
{file = "ruff-0.2.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fbd2288890b88e8aab4499e55148805b58ec711053588cc2f0196a44f6e3d855"},
|
{file = "ruff-0.2.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6a61ea0ff048e06de273b2e45bd72629f470f5da8f71daf09fe481278b175001"},
|
||||||
{file = "ruff-0.2.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3ef052283da7dec1987bba8d8733051c2325654641dfe5877a4022108098683"},
|
{file = "ruff-0.2.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e1439c8f407e4f356470e54cdecdca1bd5439a0673792dbe34a2b0a551a2fe3"},
|
||||||
{file = "ruff-0.2.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:7022d66366d6fded4ba3889f73cd791c2d5621b2ccf34befc752cb0df70f5fad"},
|
{file = "ruff-0.2.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:940de32dc8853eba0f67f7198b3e79bc6ba95c2edbfdfac2144c8235114d6726"},
|
||||||
{file = "ruff-0.2.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0a725823cb2a3f08ee743a534cb6935727d9e47409e4ad72c10a3faf042ad5ba"},
|
{file = "ruff-0.2.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0c126da55c38dd917621552ab430213bdb3273bb10ddb67bc4b761989210eb6e"},
|
||||||
{file = "ruff-0.2.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:0034d5b6323e6e8fe91b2a1e55b02d92d0b582d2953a2b37a67a2d7dedbb7acc"},
|
{file = "ruff-0.2.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:3b65494f7e4bed2e74110dac1f0d17dc8e1f42faaa784e7c58a98e335ec83d7e"},
|
||||||
{file = "ruff-0.2.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e5cb5526d69bb9143c2e4d2a115d08ffca3d8e0fddc84925a7b54931c96f5c02"},
|
{file = "ruff-0.2.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:1ec49be4fe6ddac0503833f3ed8930528e26d1e60ad35c2446da372d16651ce9"},
|
||||||
{file = "ruff-0.2.1-py3-none-win32.whl", hash = "sha256:6b95ac9ce49b4fb390634d46d6ece32ace3acdd52814671ccaf20b7f60adb232"},
|
{file = "ruff-0.2.2-py3-none-win32.whl", hash = "sha256:d920499b576f6c68295bc04e7b17b6544d9d05f196bb3aac4358792ef6f34325"},
|
||||||
{file = "ruff-0.2.1-py3-none-win_amd64.whl", hash = "sha256:e3affdcbc2afb6f5bd0eb3130139ceedc5e3f28d206fe49f63073cb9e65988e0"},
|
{file = "ruff-0.2.2-py3-none-win_amd64.whl", hash = "sha256:cc9a91ae137d687f43a44c900e5d95e9617cb37d4c989e462980ba27039d239d"},
|
||||||
{file = "ruff-0.2.1-py3-none-win_arm64.whl", hash = "sha256:efababa8e12330aa94a53e90a81eb6e2d55f348bc2e71adbf17d9cad23c03ee6"},
|
{file = "ruff-0.2.2-py3-none-win_arm64.whl", hash = "sha256:c9d15fc41e6054bfc7200478720570078f0b41c9ae4f010bcc16bd6f4d1aacdd"},
|
||||||
{file = "ruff-0.2.1.tar.gz", hash = "sha256:3b42b5d8677cd0c72b99fcaf068ffc62abb5a19e71b4a3b9cfa50658a0af02f1"},
|
{file = "ruff-0.2.2.tar.gz", hash = "sha256:e62ed7f36b3068a30ba39193a14274cd706bc486fad521276458022f7bccb31d"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1222,24 +1222,24 @@ files = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tzdata"
|
name = "tzdata"
|
||||||
version = "2023.4"
|
version = "2024.1"
|
||||||
description = "Provider of IANA time zone data"
|
description = "Provider of IANA time zone data"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2"
|
python-versions = ">=2"
|
||||||
files = [
|
files = [
|
||||||
{file = "tzdata-2023.4-py2.py3-none-any.whl", hash = "sha256:aa3ace4329eeacda5b7beb7ea08ece826c28d761cda36e747cfbf97996d39bf3"},
|
{file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"},
|
||||||
{file = "tzdata-2023.4.tar.gz", hash = "sha256:dd54c94f294765522c77399649b4fefd95522479a664a0cec87f41bebc6148c9"},
|
{file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "virtualenv"
|
name = "virtualenv"
|
||||||
version = "20.25.0"
|
version = "20.25.1"
|
||||||
description = "Virtual Python Environment builder"
|
description = "Virtual Python Environment builder"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "virtualenv-20.25.0-py3-none-any.whl", hash = "sha256:4238949c5ffe6876362d9c0180fc6c3a824a7b12b80604eeb8085f2ed7460de3"},
|
{file = "virtualenv-20.25.1-py3-none-any.whl", hash = "sha256:961c026ac520bac5f69acb8ea063e8a4f071bcc9457b9c1f28f6b085c511583a"},
|
||||||
{file = "virtualenv-20.25.0.tar.gz", hash = "sha256:bf51c0d9c7dd63ea8e44086fa1e4fb1093a31e963b86959257378aef020e1f1b"},
|
{file = "virtualenv-20.25.1.tar.gz", hash = "sha256:e08e13ecdca7a0bd53798f356d5831434afa5b07b93f0abdf0797b7a06ffe197"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
|
|
|
@ -37,6 +37,8 @@ profile = "black"
|
||||||
pythonpath = [
|
pythonpath = [
|
||||||
"resa_padel"
|
"resa_padel"
|
||||||
]
|
]
|
||||||
|
log_cli = 1
|
||||||
|
log_cli_level = "DEBUG"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
|
|
|
@ -32,7 +32,7 @@ def main() -> int | None:
|
||||||
club = config.get_club()
|
club = config.get_club()
|
||||||
|
|
||||||
LOGGER.info(
|
LOGGER.info(
|
||||||
"Starting booking court of %s for user %s at club %s at %s",
|
"Starting booking court of sport %s for user %s at club %s at %s",
|
||||||
booking_filter.sport_id,
|
booking_filter.sport_id,
|
||||||
user.login,
|
user.login,
|
||||||
club.id,
|
club.id,
|
||||||
|
|
|
@ -58,7 +58,7 @@ class GestionSportsConnector:
|
||||||
|
|
||||||
:return: the response from the landing page
|
:return: the response from the landing page
|
||||||
"""
|
"""
|
||||||
LOGGER.info("Connecting to GestionSports API")
|
LOGGER.info("Connecting to GestionSports API at %s", self.login_url)
|
||||||
async with self.session.get(self.landing_url) as response:
|
async with self.session.get(self.landing_url) as response:
|
||||||
await response.text()
|
await response.text()
|
||||||
return response
|
return response
|
||||||
|
@ -69,18 +69,21 @@ class GestionSportsConnector:
|
||||||
|
|
||||||
:return: the response from the login
|
:return: the response from the login
|
||||||
"""
|
"""
|
||||||
|
LOGGER.info("Logging in to GestionSports API at %s", self.login_url)
|
||||||
payload_builder = GestionSportsLoginPayloadBuilder()
|
payload_builder = GestionSportsLoginPayloadBuilder()
|
||||||
payload = payload_builder.user(user).club(club).build()
|
payload = payload_builder.user(user).club(club).build()
|
||||||
|
|
||||||
async with self.session.post(
|
async with self.session.post(
|
||||||
self.login_url, data=payload, headers=POST_HEADERS
|
self.login_url, data=payload, headers=POST_HEADERS
|
||||||
) as response:
|
) as response:
|
||||||
await response.text()
|
resp_text = await response.text()
|
||||||
|
LOGGER.debug("Connexion request response:\n%s", resp_text)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
async def book(self, booking_filter: BookingFilter, club: Club) -> int | None:
|
async def book(self, booking_filter: BookingFilter, club: Club) -> int | None:
|
||||||
"""
|
"""
|
||||||
Perform a request for each court at the same time to increase the chances to get a booking.
|
Perform a request for each court at the same time to increase the chances to get
|
||||||
|
a booking.
|
||||||
The gestion-sports backend does not allow several bookings at the same time
|
The gestion-sports backend does not allow several bookings at the same time
|
||||||
so there is no need to make each request one after the other
|
so there is no need to make each request one after the other
|
||||||
|
|
||||||
|
@ -88,6 +91,9 @@ class GestionSportsConnector:
|
||||||
:param club: the club where to book the court
|
:param club: the club where to book the court
|
||||||
:return: the booked court, or None if no court was booked
|
:return: the booked court, or None if no court was booked
|
||||||
"""
|
"""
|
||||||
|
LOGGER.info(
|
||||||
|
"Booking any available court from GestionSports API at %s", self.booking_url
|
||||||
|
)
|
||||||
# use asyncio to request a booking on every court
|
# use asyncio to request a booking on every court
|
||||||
# the gestion-sports backend is able to book only one court for a user
|
# the gestion-sports backend is able to book only one court for a user
|
||||||
bookings = await asyncio.gather(
|
bookings = await asyncio.gather(
|
||||||
|
@ -98,36 +104,51 @@ class GestionSportsConnector:
|
||||||
return_exceptions=True,
|
return_exceptions=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
LOGGER.debug("Booking results:\n'%s'", bookings)
|
||||||
return self.get_booked_court(bookings)
|
return self.get_booked_court(bookings)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_booked_court(bookings):
|
|
||||||
LOGGER.info(bookings)
|
|
||||||
for court, is_booked in bookings:
|
|
||||||
if is_booked:
|
|
||||||
return court
|
|
||||||
return None
|
|
||||||
|
|
||||||
async def book_one_court(
|
async def book_one_court(
|
||||||
self, booking_filter: BookingFilter, court_id: int
|
self, booking_filter: BookingFilter, court_id: int
|
||||||
) -> tuple[int, bool]:
|
) -> tuple[int, bool]:
|
||||||
|
"""
|
||||||
|
Book a single court according to the information provided in the booking filter
|
||||||
|
|
||||||
|
:param booking_filter: the booking information
|
||||||
|
:param court_id: the id of the court to book
|
||||||
|
:return: a tuple containing the court id and the booking status
|
||||||
|
"""
|
||||||
|
LOGGER.debug(
|
||||||
|
"Booking court %s at %s",
|
||||||
|
court_id,
|
||||||
|
booking_filter.date.to_w3c_string(),
|
||||||
|
)
|
||||||
payload_builder = GestionSportsBookingPayloadBuilder()
|
payload_builder = GestionSportsBookingPayloadBuilder()
|
||||||
payload = (
|
payload = (
|
||||||
payload_builder.booking_filter(booking_filter).court_id(court_id).build()
|
payload_builder.booking_filter(booking_filter).court_id(court_id).build()
|
||||||
)
|
)
|
||||||
LOGGER.info(payload)
|
LOGGER.debug("Booking court %s request:\n'%s'", court_id, payload)
|
||||||
|
|
||||||
async with self.session.post(
|
async with self.session.post(
|
||||||
self.booking_url, data=payload, headers=POST_HEADERS
|
self.booking_url, data=payload, headers=POST_HEADERS
|
||||||
) as response:
|
) as response:
|
||||||
resp_json = await response.text()
|
resp_json = await response.text()
|
||||||
|
LOGGER.debug("Response from booking request:\n'%s'", resp_json)
|
||||||
return court_id, self.is_response_status_ok(resp_json)
|
return court_id, self.is_response_status_ok(resp_json)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_response_status_ok(response: str) -> bool:
|
def get_booked_court(bookings):
|
||||||
|
for court, is_booked in bookings:
|
||||||
|
if is_booked:
|
||||||
|
LOGGER.debug("Court %s is booked", court)
|
||||||
|
return court
|
||||||
|
LOGGER.debug("No booked court found")
|
||||||
|
return None
|
||||||
|
|
||||||
LOGGER.info(response)
|
@staticmethod
|
||||||
|
def is_response_status_ok(response: str) -> bool:
|
||||||
formatted_result = response.removeprefix('"').removesuffix('"')
|
formatted_result = response.removeprefix('"').removesuffix('"')
|
||||||
result_json = json.loads(formatted_result)
|
result_json = json.loads(formatted_result)
|
||||||
return result_json["status"] == "ok"
|
return result_json["status"] == "ok"
|
||||||
|
|
||||||
|
def get_user_information(self):
|
||||||
|
pass
|
||||||
|
|
|
@ -12,6 +12,7 @@ LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
class GestionSportsPlatform:
|
class GestionSportsPlatform:
|
||||||
def __init__(self, club: Club):
|
def __init__(self, club: Club):
|
||||||
|
LOGGER.info("Initializing Gestion Sports platform at url %s", club.url)
|
||||||
self.connector: GestionSportsConnector | None = None
|
self.connector: GestionSportsConnector | None = None
|
||||||
self.club: Club = club
|
self.club: Club = club
|
||||||
self.session: ClientSession | None = None
|
self.session: ClientSession | None = None
|
||||||
|
@ -25,14 +26,24 @@ class GestionSportsPlatform:
|
||||||
await self.session.close()
|
await self.session.close()
|
||||||
|
|
||||||
async def book(self, user: User, booking_filter: BookingFilter) -> int | None:
|
async def book(self, user: User, booking_filter: BookingFilter) -> int | None:
|
||||||
if self.connector is None or user is None or booking_filter is None:
|
if self.connector is None:
|
||||||
return None
|
LOGGER.error("No connection to Gestion Sports is available")
|
||||||
|
return
|
||||||
|
|
||||||
|
if user is None or booking_filter is None:
|
||||||
|
LOGGER.error("Not enough information available to book a court")
|
||||||
|
return
|
||||||
|
|
||||||
await self.connector.land()
|
await self.connector.land()
|
||||||
await self.connector.login(user, self.club)
|
await self.connector.login(user, self.club)
|
||||||
wait_until_booking_time(self.club, booking_filter)
|
wait_until_booking_time(self.club, booking_filter)
|
||||||
return await self.connector.book(booking_filter, self.club)
|
return await self.connector.book(booking_filter, self.club)
|
||||||
|
|
||||||
|
async def user_can_book(self, user: User, club: Club):
|
||||||
|
await self.connector.land()
|
||||||
|
await self.connector.login(user, self.club)
|
||||||
|
await self.connector.get_user_information()
|
||||||
|
|
||||||
|
|
||||||
def wait_until_booking_time(club: Club, booking_filter: BookingFilter):
|
def wait_until_booking_time(club: Club, booking_filter: BookingFilter):
|
||||||
"""
|
"""
|
||||||
|
@ -43,12 +54,21 @@ def wait_until_booking_time(club: Club, booking_filter: BookingFilter):
|
||||||
:param club: the club where to book a court
|
:param club: the club where to book a court
|
||||||
:param booking_filter: the booking information
|
:param booking_filter: the booking information
|
||||||
"""
|
"""
|
||||||
LOGGER.info("Waiting booking time")
|
LOGGER.info("Waiting for booking time")
|
||||||
booking_datetime = build_booking_datetime(booking_filter, club)
|
booking_datetime = build_booking_datetime(booking_filter, club)
|
||||||
now = pendulum.now()
|
now = pendulum.now()
|
||||||
|
duration_until_booking = booking_datetime - now
|
||||||
|
LOGGER.debug(
|
||||||
|
"Time to wait before booking: %s:%s:%s",
|
||||||
|
"{:0>2}".format(duration_until_booking.hours),
|
||||||
|
"{:0>2}".format(duration_until_booking.minutes),
|
||||||
|
"{:0>2}".format(duration_until_booking.seconds),
|
||||||
|
)
|
||||||
|
|
||||||
while now < booking_datetime:
|
while now < booking_datetime:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
now = pendulum.now()
|
now = pendulum.now()
|
||||||
|
LOGGER.info("It's booking time!")
|
||||||
|
|
||||||
|
|
||||||
def build_booking_datetime(booking_filter: BookingFilter, club: Club) -> DateTime:
|
def build_booking_datetime(booking_filter: BookingFilter, club: Club) -> DateTime:
|
||||||
|
|
|
@ -13,6 +13,7 @@ from tests.fixtures import (
|
||||||
)
|
)
|
||||||
|
|
||||||
tpc_url = "https://toulousepadelclub.gestion-sports.com"
|
tpc_url = "https://toulousepadelclub.gestion-sports.com"
|
||||||
|
o = "https://toulousepadelclub.gestion-sports.fr"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
@ -81,7 +82,27 @@ async def test_booking_url_should_be_reachable(
|
||||||
|
|
||||||
court_booked = await gs_connector.book(a_booking_filter, a_club)
|
court_booked = await gs_connector.book(a_booking_filter, a_club)
|
||||||
# At 18:00 no chance to get a booking, any day of the week
|
# At 18:00 no chance to get a booking, any day of the week
|
||||||
assert court_booked is None
|
assert court_booked in [
|
||||||
|
None,
|
||||||
|
597,
|
||||||
|
598,
|
||||||
|
599,
|
||||||
|
600,
|
||||||
|
601,
|
||||||
|
602,
|
||||||
|
603,
|
||||||
|
604,
|
||||||
|
605,
|
||||||
|
606,
|
||||||
|
607,
|
||||||
|
608,
|
||||||
|
609,
|
||||||
|
610,
|
||||||
|
611,
|
||||||
|
612,
|
||||||
|
613,
|
||||||
|
614,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
|
@ -3,7 +3,10 @@ from unittest.mock import patch
|
||||||
import pendulum
|
import pendulum
|
||||||
import pytest
|
import pytest
|
||||||
from aioresponses import aioresponses
|
from aioresponses import aioresponses
|
||||||
from gestion_sports.gestion_sports_platform import GestionSportsPlatform
|
from gestion_sports.gestion_sports_platform import (
|
||||||
|
GestionSportsPlatform,
|
||||||
|
wait_until_booking_time,
|
||||||
|
)
|
||||||
from models import BookingFilter, Club, User
|
from models import BookingFilter, Club, User
|
||||||
|
|
||||||
from tests import fixtures, utils
|
from tests import fixtures, utils
|
||||||
|
@ -76,6 +79,6 @@ def test_wait_until_booking_time(
|
||||||
]
|
]
|
||||||
mock_now.side_effect = seconds
|
mock_now.side_effect = seconds
|
||||||
|
|
||||||
gestion_sports_operations.wait_until_booking_time(a_club, a_booking_filter)
|
wait_until_booking_time(a_club, a_booking_filter)
|
||||||
|
|
||||||
assert pendulum.now() == booking_datetime.add(microseconds=1)
|
assert pendulum.now() == booking_datetime.add(microseconds=1)
|
||||||
|
|
|
@ -89,3 +89,4 @@ def mock_rest_api_from_connection_to_booking(
|
||||||
booking_url = urljoin(url, "/membre/reservation.html?")
|
booking_url = urljoin(url, "/membre/reservation.html?")
|
||||||
mock_booking(aio_mock, booking_url, a_booking_failure_response)
|
mock_booking(aio_mock, booking_url, a_booking_failure_response)
|
||||||
mock_booking(aio_mock, booking_url, a_booking_success_response)
|
mock_booking(aio_mock, booking_url, a_booking_success_response)
|
||||||
|
mock_booking(aio_mock, booking_url, a_booking_failure_response)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue