diff --git a/.env.localhost.template b/.env.localhost.template index d31fc29..a5b5e41 100644 --- a/.env.localhost.template +++ b/.env.localhost.template @@ -1,6 +1,6 @@ # COMMONS -MONGODB_URL=mongodb://localhost:27017/winds -REDIS_URL=redis://localhost:6379/0 +MONGODB_URL=mongodb://localhost:8011/winds +REDIS_URL=redis://localhost:8012/0 GOOGLE_API_KEY= # PROVIDERS diff --git a/.env.template b/.env.template index 8bcbd4d..3cb033a 100644 --- a/.env.template +++ b/.env.template @@ -1,6 +1,6 @@ # COMMONS MONGODB_URL=mongodb://mongodb:27017/winds -REDIS_URL=redis://host.docker.internal:6379/0 +REDIS_URL=redis://redis:6379/0 GOOGLE_API_KEY= # PROVIDERS diff --git a/docker-compose.yml b/docker-compose.yml index 3492f28..fb96261 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,14 +4,14 @@ services: mongodb: image: mongo:4.4.10 ports: - - "27017:27017" + - "8011:27017" volumes: - ./volumes/mongodb:/data/db redis: image: redis:6.2.6 ports: - - "6379:6379" + - "8012:6379" providers: build: diff --git a/poetry.lock b/poetry.lock index fd3f37b..756c634 100644 --- a/poetry.lock +++ b/poetry.lock @@ -59,25 +59,24 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "black" -version = "21.12b0" +version = "22.1.0" description = "The uncompromising code formatter." category = "dev" optional = false python-versions = ">=3.6.2" [package.dependencies] -click = ">=7.1.2" +click = ">=8.0.0" mypy-extensions = ">=0.4.3" -pathspec = ">=0.9.0,<1" +pathspec = ">=0.9.0" platformdirs = ">=2" -tomli = ">=0.2.6,<2.0.0" -typing-extensions = ">=3.10.0.0" +tomli = ">=1.1.0" +typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} [package.extras] colorama = ["colorama (>=0.4.3)"] d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -python2 = ["typed-ast (>=1.4.3)"] uvloop = ["uvloop (>=0.15.2)"] [[package]] @@ -98,7 +97,7 @@ python-versions = "*" [[package]] name = "charset-normalizer" -version = "2.0.10" +version = "2.0.12" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "main" optional = false @@ -109,7 +108,7 @@ unicode_backport = ["unicodedata2"] [[package]] name = "click" -version = "8.0.3" +version = "8.0.4" description = "Composable command line interface toolkit" category = "dev" optional = false @@ -226,7 +225,7 @@ python-versions = ">=3.5" [[package]] name = "numpy" -version = "1.22.0" +version = "1.22.3" description = "NumPy is the fundamental package for array computing with Python." category = "main" optional = false @@ -280,7 +279,7 @@ uncertainties = ["uncertainties (>=3.0)"] [[package]] name = "platformdirs" -version = "2.4.1" +version = "2.5.1" description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false @@ -365,7 +364,7 @@ zstd = ["zstandard"] [[package]] name = "pyparsing" -version = "3.0.6" +version = "3.0.7" description = "Python parsing module" category = "main" optional = false @@ -515,7 +514,7 @@ numpy = ">=1.16.5,<1.23.0" [[package]] name = "sentry-sdk" -version = "1.5.1" +version = "1.5.8" description = "Python client for Sentry (https://sentry.io)" category = "main" optional = false @@ -537,6 +536,7 @@ flask = ["flask (>=0.11)", "blinker (>=1.1)"] httpx = ["httpx (>=0.16.0)"] pure_eval = ["pure-eval", "executing", "asttokens"] pyspark = ["pyspark (>=2.4.4)"] +quart = ["quart (>=0.16.1)", "blinker (>=1.1)"] rq = ["rq (>=0.6)"] sanic = ["sanic (>=0.8)"] sqlalchemy = ["sqlalchemy (>=1.2)"] @@ -563,7 +563,7 @@ doc = ["reno", "sphinx", "tornado (>=4.5)"] [[package]] name = "threadpoolctl" -version = "3.0.0" +version = "3.1.0" description = "threadpoolctl" category = "main" optional = false @@ -579,15 +579,15 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "tomli" -version = "1.2.3" +version = "2.0.1" description = "A lil' TOML parser" category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" [[package]] name = "typing-extensions" -version = "4.0.1" +version = "4.1.1" description = "Backported and Experimental Type Hints for Python 3.6+" category = "dev" optional = false @@ -606,14 +606,14 @@ pytz = "*" [[package]] name = "urllib3" -version = "1.26.8" +version = "1.26.9" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" [package.extras] -brotli = ["brotlipy (>=0.6.0)"] +brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] @@ -628,7 +628,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [metadata] lock-version = "1.1" python-versions = "3.9.*" -content-hash = "c9f0ae18627379d04d1568dd0fc91190af6e8b0cb3a8d94bf57311afa997769c" +content-hash = "9ee20010a1a51f0ee69a5e078834a4514b7afd9e2ff8f82447085df322d88bf7" [metadata.files] apscheduler = [ @@ -648,8 +648,29 @@ attrs = [ {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, ] black = [ - {file = "black-21.12b0-py3-none-any.whl", hash = "sha256:a615e69ae185e08fdd73e4715e260e2479c861b5740057fde6e8b4e3b7dd589f"}, - {file = "black-21.12b0.tar.gz", hash = "sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3"}, + {file = "black-22.1.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:1297c63b9e1b96a3d0da2d85d11cd9bf8664251fd69ddac068b98dc4f34f73b6"}, + {file = "black-22.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2ff96450d3ad9ea499fc4c60e425a1439c2120cbbc1ab959ff20f7c76ec7e866"}, + {file = "black-22.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e21e1f1efa65a50e3960edd068b6ae6d64ad6235bd8bfea116a03b21836af71"}, + {file = "black-22.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2f69158a7d120fd641d1fa9a921d898e20d52e44a74a6fbbcc570a62a6bc8ab"}, + {file = "black-22.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:228b5ae2c8e3d6227e4bde5920d2fc66cc3400fde7bcc74f480cb07ef0b570d5"}, + {file = "black-22.1.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:b1a5ed73ab4c482208d20434f700d514f66ffe2840f63a6252ecc43a9bc77e8a"}, + {file = "black-22.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:35944b7100af4a985abfcaa860b06af15590deb1f392f06c8683b4381e8eeaf0"}, + {file = "black-22.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:7835fee5238fc0a0baf6c9268fb816b5f5cd9b8793423a75e8cd663c48d073ba"}, + {file = "black-22.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dae63f2dbf82882fa3b2a3c49c32bffe144970a573cd68d247af6560fc493ae1"}, + {file = "black-22.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fa1db02410b1924b6749c245ab38d30621564e658297484952f3d8a39fce7e8"}, + {file = "black-22.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:c8226f50b8c34a14608b848dc23a46e5d08397d009446353dad45e04af0c8e28"}, + {file = "black-22.1.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:2d6f331c02f0f40aa51a22e479c8209d37fcd520c77721c034517d44eecf5912"}, + {file = "black-22.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:742ce9af3086e5bd07e58c8feb09dbb2b047b7f566eb5f5bc63fd455814979f3"}, + {file = "black-22.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fdb8754b453fb15fad3f72cd9cad3e16776f0964d67cf30ebcbf10327a3777a3"}, + {file = "black-22.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5660feab44c2e3cb24b2419b998846cbb01c23c7fe645fee45087efa3da2d61"}, + {file = "black-22.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:6f2f01381f91c1efb1451998bd65a129b3ed6f64f79663a55fe0e9b74a5f81fd"}, + {file = "black-22.1.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:efbadd9b52c060a8fc3b9658744091cb33c31f830b3f074422ed27bad2b18e8f"}, + {file = "black-22.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8871fcb4b447206904932b54b567923e5be802b9b19b744fdff092bd2f3118d0"}, + {file = "black-22.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ccad888050f5393f0d6029deea2a33e5ae371fd182a697313bdbd835d3edaf9c"}, + {file = "black-22.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07e5c049442d7ca1a2fc273c79d1aecbbf1bc858f62e8184abe1ad175c4f7cc2"}, + {file = "black-22.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:373922fc66676133ddc3e754e4509196a8c392fec3f5ca4486673e685a421321"}, + {file = "black-22.1.0-py3-none-any.whl", hash = "sha256:3524739d76b6b3ed1132422bf9d82123cd1705086723bc3e235ca39fd21c667d"}, + {file = "black-22.1.0.tar.gz", hash = "sha256:a7c0192d35635f6fc1174be575cb7915e92e5dd629ee79fdaf0dcfa41a80afb5"}, ] cachetools = [ {file = "cachetools-4.2.4-py3-none-any.whl", hash = "sha256:92971d3cb7d2a97efff7c7bb1657f21a8f5fb309a37530537c71b1774189f2d1"}, @@ -660,12 +681,12 @@ certifi = [ {file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"}, ] charset-normalizer = [ - {file = "charset-normalizer-2.0.10.tar.gz", hash = "sha256:876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd"}, - {file = "charset_normalizer-2.0.10-py3-none-any.whl", hash = "sha256:cb957888737fc0bbcd78e3df769addb41fd1ff8cf950dc9e7ad7793f1bf44455"}, + {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, + {file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"}, ] click = [ - {file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"}, - {file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"}, + {file = "click-8.0.4-py3-none-any.whl", hash = "sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1"}, + {file = "click-8.0.4.tar.gz", hash = "sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb"}, ] colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, @@ -772,28 +793,26 @@ mysqlclient = [ {file = "mysqlclient-2.1.0.tar.gz", hash = "sha256:973235686f1b720536d417bf0a0d39b4ab3d5086b2b6ad5e6752393428c02b12"}, ] numpy = [ - {file = "numpy-1.22.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3d22662b4b10112c545c91a0741f2436f8ca979ab3d69d03d19322aa970f9695"}, - {file = "numpy-1.22.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:11a1f3816ea82eed4178102c56281782690ab5993251fdfd75039aad4d20385f"}, - {file = "numpy-1.22.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5dc65644f75a4c2970f21394ad8bea1a844104f0fe01f278631be1c7eae27226"}, - {file = "numpy-1.22.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42c16cec1c8cf2728f1d539bd55aaa9d6bb48a7de2f41eb944697293ef65a559"}, - {file = "numpy-1.22.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a97e82c39d9856fe7d4f9b86d8a1e66eff99cf3a8b7ba48202f659703d27c46f"}, - {file = "numpy-1.22.0-cp310-cp310-win_amd64.whl", hash = "sha256:e41e8951749c4b5c9a2dc5fdbc1a4eec6ab2a140fdae9b460b0f557eed870f4d"}, - {file = "numpy-1.22.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:bece0a4a49e60e472a6d1f70ac6cdea00f9ab80ff01132f96bd970cdd8a9e5a9"}, - {file = "numpy-1.22.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:818b9be7900e8dc23e013a92779135623476f44a0de58b40c32a15368c01d471"}, - {file = "numpy-1.22.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:47ee7a839f5885bc0c63a74aabb91f6f40d7d7b639253768c4199b37aede7982"}, - {file = "numpy-1.22.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a024181d7aef0004d76fb3bce2a4c9f2e67a609a9e2a6ff2571d30e9976aa383"}, - {file = "numpy-1.22.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f71d57cc8645f14816ae249407d309be250ad8de93ef61d9709b45a0ddf4050c"}, - {file = "numpy-1.22.0-cp38-cp38-win32.whl", hash = "sha256:283d9de87c0133ef98f93dfc09fad3fb382f2a15580de75c02b5bb36a5a159a5"}, - {file = "numpy-1.22.0-cp38-cp38-win_amd64.whl", hash = "sha256:2762331de395739c91f1abb88041f94a080cb1143aeec791b3b223976228af3f"}, - {file = "numpy-1.22.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:76ba7c40e80f9dc815c5e896330700fd6e20814e69da9c1267d65a4d051080f1"}, - {file = "numpy-1.22.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0cfe07133fd00b27edee5e6385e333e9eeb010607e8a46e1cd673f05f8596595"}, - {file = "numpy-1.22.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6ed0d073a9c54ac40c41a9c2d53fcc3d4d4ed607670b9e7b0de1ba13b4cbfe6f"}, - {file = "numpy-1.22.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41388e32e40b41dd56eb37fcaa7488b2b47b0adf77c66154d6b89622c110dfe9"}, - {file = "numpy-1.22.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b55b953a1bdb465f4dc181758570d321db4ac23005f90ffd2b434cc6609a63dd"}, - {file = "numpy-1.22.0-cp39-cp39-win32.whl", hash = "sha256:5a311ee4d983c487a0ab546708edbdd759393a3dc9cd30305170149fedd23c88"}, - {file = "numpy-1.22.0-cp39-cp39-win_amd64.whl", hash = "sha256:a97a954a8c2f046d3817c2bce16e3c7e9a9c2afffaf0400f5c16df5172a67c9c"}, - {file = "numpy-1.22.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bb02929b0d6bfab4c48a79bd805bd7419114606947ec8284476167415171f55b"}, - {file = "numpy-1.22.0.zip", hash = "sha256:a955e4128ac36797aaffd49ab44ec74a71c11d6938df83b1285492d277db5397"}, + {file = "numpy-1.22.3-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:92bfa69cfbdf7dfc3040978ad09a48091143cffb778ec3b03fa170c494118d75"}, + {file = "numpy-1.22.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8251ed96f38b47b4295b1ae51631de7ffa8260b5b087808ef09a39a9d66c97ab"}, + {file = "numpy-1.22.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:48a3aecd3b997bf452a2dedb11f4e79bc5bfd21a1d4cc760e703c31d57c84b3e"}, + {file = "numpy-1.22.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a3bae1a2ed00e90b3ba5f7bd0a7c7999b55d609e0c54ceb2b076a25e345fa9f4"}, + {file = "numpy-1.22.3-cp310-cp310-win32.whl", hash = "sha256:f950f8845b480cffe522913d35567e29dd381b0dc7e4ce6a4a9f9156417d2430"}, + {file = "numpy-1.22.3-cp310-cp310-win_amd64.whl", hash = "sha256:08d9b008d0156c70dc392bb3ab3abb6e7a711383c3247b410b39962263576cd4"}, + {file = "numpy-1.22.3-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:201b4d0552831f7250a08d3b38de0d989d6f6e4658b709a02a73c524ccc6ffce"}, + {file = "numpy-1.22.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f8c1f39caad2c896bc0018f699882b345b2a63708008be29b1f355ebf6f933fe"}, + {file = "numpy-1.22.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:568dfd16224abddafb1cbcce2ff14f522abe037268514dd7e42c6776a1c3f8e5"}, + {file = "numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ca688e1b9b95d80250bca34b11a05e389b1420d00e87a0d12dc45f131f704a1"}, + {file = "numpy-1.22.3-cp38-cp38-win32.whl", hash = "sha256:e7927a589df200c5e23c57970bafbd0cd322459aa7b1ff73b7c2e84d6e3eae62"}, + {file = "numpy-1.22.3-cp38-cp38-win_amd64.whl", hash = "sha256:07a8c89a04997625236c5ecb7afe35a02af3896c8aa01890a849913a2309c676"}, + {file = "numpy-1.22.3-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:2c10a93606e0b4b95c9b04b77dc349b398fdfbda382d2a39ba5a822f669a0123"}, + {file = "numpy-1.22.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:fade0d4f4d292b6f39951b6836d7a3c7ef5b2347f3c420cd9820a1d90d794802"}, + {file = "numpy-1.22.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5bfb1bb598e8229c2d5d48db1860bcf4311337864ea3efdbe1171fb0c5da515d"}, + {file = "numpy-1.22.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97098b95aa4e418529099c26558eeb8486e66bd1e53a6b606d684d0c3616b168"}, + {file = "numpy-1.22.3-cp39-cp39-win32.whl", hash = "sha256:fdf3c08bce27132395d3c3ba1503cac12e17282358cb4bddc25cc46b0aca07aa"}, + {file = "numpy-1.22.3-cp39-cp39-win_amd64.whl", hash = "sha256:639b54cdf6aa4f82fe37ebf70401bbb74b8508fddcf4797f9fe59615b8c5813a"}, + {file = "numpy-1.22.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c34ea7e9d13a70bf2ab64a2532fe149a9aced424cd05a2c4ba662fd989e3e45f"}, + {file = "numpy-1.22.3.zip", hash = "sha256:dbc7601a3b7472d559dc7b933b18b4b66f9aa7452c120e87dfb33d02008c8a18"}, ] orderedmultidict = [ {file = "orderedmultidict-1.0.1-py2.py3-none-any.whl", hash = "sha256:43c839a17ee3cdd62234c47deca1a8508a3f2ca1d0678a3bf791c87cf84adbf3"}, @@ -812,8 +831,8 @@ pint = [ {file = "Pint-0.18.tar.gz", hash = "sha256:8c4bce884c269051feb7abc69dbfd18403c0c764abc83da132e8a7222f8ba801"}, ] platformdirs = [ - {file = "platformdirs-2.4.1-py3-none-any.whl", hash = "sha256:1d7385c7db91728b83efd0ca99a5afb296cab9d0ed8313a45ed8ba17967ecfca"}, - {file = "platformdirs-2.4.1.tar.gz", hash = "sha256:440633ddfebcc36264232365d7840a970e75e1018d15b4327d11f91909045fda"}, + {file = "platformdirs-2.5.1-py3-none-any.whl", hash = "sha256:bcae7cab893c2d310a711b70b24efb93334febe65f8de776ee320b517471e227"}, + {file = "platformdirs-2.5.1.tar.gz", hash = "sha256:7535e70dfa32e84d4b34996ea99c5e432fa29a708d0f4e394bbcb2a8faa4f16d"}, ] pluggy = [ {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, @@ -958,8 +977,8 @@ pymongo = [ {file = "pymongo-3.12.2.tar.gz", hash = "sha256:64ea5e97fca1a37f83df9f3460bf63640bc0d725e12f3471e6acbf3a6040dd37"}, ] pyparsing = [ - {file = "pyparsing-3.0.6-py3-none-any.whl", hash = "sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4"}, - {file = "pyparsing-3.0.6.tar.gz", hash = "sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81"}, + {file = "pyparsing-3.0.7-py3-none-any.whl", hash = "sha256:a6c06a88f252e6c322f65faf8f418b16213b51bdfaece0524c1c1bc30c63c484"}, + {file = "pyparsing-3.0.7.tar.gz", hash = "sha256:18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea"}, ] pyproj = [ {file = "pyproj-3.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2c41c9b7b5e1a1b0acc2b7b2f5de65b226f7b96c870888e4f679ff96322b1ed0"}, @@ -1113,8 +1132,8 @@ scipy = [ {file = "scipy-1.7.3.tar.gz", hash = "sha256:ab5875facfdef77e0a47d5fd39ea178b58e60e454a4c85aa1e52fcb80db7babf"}, ] sentry-sdk = [ - {file = "sentry-sdk-1.5.1.tar.gz", hash = "sha256:2a1757d6611e4bec7d672c2b7ef45afef79fed201d064f53994753303944f5a8"}, - {file = "sentry_sdk-1.5.1-py2.py3-none-any.whl", hash = "sha256:e4cb107e305b2c1b919414775fa73a9997f996447417d22b98e7610ded1e9eb5"}, + {file = "sentry-sdk-1.5.8.tar.gz", hash = "sha256:38fd16a92b5ef94203db3ece10e03bdaa291481dd7e00e77a148aa0302267d47"}, + {file = "sentry_sdk-1.5.8-py2.py3-none-any.whl", hash = "sha256:32af1a57954576709242beb8c373b3dbde346ac6bd616921def29d68846fb8c3"}, ] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, @@ -1125,28 +1144,28 @@ tenacity = [ {file = "tenacity-8.0.1.tar.gz", hash = "sha256:43242a20e3e73291a28bcbcacfd6e000b02d3857a9a9fff56b297a27afdc932f"}, ] threadpoolctl = [ - {file = "threadpoolctl-3.0.0-py3-none-any.whl", hash = "sha256:4fade5b3b48ae4b1c30f200b28f39180371104fccc642e039e0f2435ec8cc211"}, - {file = "threadpoolctl-3.0.0.tar.gz", hash = "sha256:d03115321233d0be715f0d3a5ad1d6c065fe425ddc2d671ca8e45e9fd5d7a52a"}, + {file = "threadpoolctl-3.1.0-py3-none-any.whl", hash = "sha256:8b99adda265feb6773280df41eece7b2e6561b772d21ffd52e372f999024907b"}, + {file = "threadpoolctl-3.1.0.tar.gz", hash = "sha256:a335baacfaa4400ae1f0d8e3a58d6674d2f8828e3716bb2802c44955ad391380"}, ] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] tomli = [ - {file = "tomli-1.2.3-py3-none-any.whl", hash = "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"}, - {file = "tomli-1.2.3.tar.gz", hash = "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f"}, + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] typing-extensions = [ - {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, - {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, + {file = "typing_extensions-4.1.1-py3-none-any.whl", hash = "sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2"}, + {file = "typing_extensions-4.1.1.tar.gz", hash = "sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42"}, ] tzlocal = [ {file = "tzlocal-2.1-py2.py3-none-any.whl", hash = "sha256:e2cb6c6b5b604af38597403e9852872d7f534962ae2954c7f35efcb1ccacf4a4"}, {file = "tzlocal-2.1.tar.gz", hash = "sha256:643c97c5294aedc737780a49d9df30889321cbe1204eac2c2ec6134035a92e44"}, ] urllib3 = [ - {file = "urllib3-1.26.8-py2.py3-none-any.whl", hash = "sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed"}, - {file = "urllib3-1.26.8.tar.gz", hash = "sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c"}, + {file = "urllib3-1.26.9-py2.py3-none-any.whl", hash = "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14"}, + {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, ] xmltodict = [ {file = "xmltodict-0.12.0-py2.py3-none-any.whl", hash = "sha256:8bbcb45cc982f48b2ca8fe7e7827c5d792f217ecf1792626f808bf41c3b86051"}, diff --git a/providers/fluggruppe_aletsch.py b/providers/fluggruppe_aletsch.py index fb66e73..e7198b3 100644 --- a/providers/fluggruppe_aletsch.py +++ b/providers/fluggruppe_aletsch.py @@ -8,167 +8,32 @@ from winds_mobi_provider import Provider, ProviderException, StationStatus oberwallis_tz = tz.gettz("Europe/Zurich") +dd_pattern = re.compile(r"(\d*)°.([\d.]*)'.([ONWS]+)") -class FluggruppeAletsch(Provider): - provider_code = "aletsch" - provider_name = "fluggruppe-aletsch.ch" - provider_url = "https://fluggruppe-aletsch.ch" - - url = "https://meteo-oberwallis.ch/wetter/{}/daten.xml" - - stations = [ - ["ried-brig", "ried-brig/XML"], - ["blitzingu", "blitzingu/XML"], - ["bellwald", "bellwald/XML"], - ["fieschertal", "fiesch/XML"], - ["chaeserstatt", "chaeserstatt/XML"], - ["jeizinen", "jeizinen/XML"], - ["grimsel", "grimselpass/XML"], - ] - - def process_data(self): - self.log.info("Processing Fluggruppe Aletsch Data...") - for fga_id, fga_path in self.stations: - try: - response = requests.get(self.url.format(fga_path), timeout=(self.connect_timeout, self.read_timeout)) - parser = FgaStationParser(response.text) - - station = self.save_station( - fga_id, - parser.name(), - parser.name(), - parser.latitude(), - parser.longitude(), - StationStatus.GREEN, - altitude=parser.elevation(), - ) - - measures_collection = self.measures_collection(station["_id"]) - key = parser.key() - if not self.has_measure(measures_collection, key): - try: - measure = self.create_measure( - station, - key, - parser.direction(), - parser.speed(), - parser.speed_max(), - rain=parser.rain(), - temperature=parser.temperature(), - humidity=parser.humidity(), - ) - - self.insert_new_measures(measures_collection, station, [measure]) - except ProviderException as e: - self.log.warning(f"Error while processing measure '{key}' for station '{fga_id}': {e}") - except Exception as e: - self.log.exception(f"Error while processing measure '{key}' for station '{fga_id}': {e}") - - except ProviderException as e: - self.log.warning(f"Error while processing station '{fga_id}': {e}") - except Exception as e: - self.log.exception(f"Error while processing station '{fga_id}': {e}") - - self.log.info("...Done Type1 via Meteo Oberwallis!") - - stations_type_2 = [ - ["rothorli", "rothorli", "Visperterminen Rothorn", "7.938", "46.2497"], - ["klaena", "klaena", "Rosswald Klaena", "8.0632", "46.3135"], - ] - - def process_data2(self): - self.log.info("Processing Fluggruppe Aletsch Data Type 2...") - for fga_id, fga_path, fga_desc, fga_long, fga_lat in self.stations_type_2: - try: - response = requests.get(self.url.format(fga_path), timeout=(self.connect_timeout, self.read_timeout)) - parser = FgaStationParserType2(response.text) - - station = self.save_station( - fga_id, fga_desc, fga_desc, fga_lat, fga_long, StationStatus.GREEN, altitude=parser.elevation() - ) - - measures_collection = self.measures_collection(station["_id"]) - key = parser.key() - if not self.has_measure(measures_collection, key): - try: - measure = self.create_measure( - station, - key, - parser.direction(), - parser.speed(), - parser.speed_max(), - rain=parser.rain(), - temperature=parser.temperature(), - humidity=parser.humidity(), - ) - - self.insert_new_measures(measures_collection, station, [measure]) - except ProviderException as e: - self.log.warning(f"Error while processing measure '{key}' for station '{fga_id}': {e}") - except Exception as e: - self.log.exception(f"Error while processing measure '{key}' for station '{fga_id}': {e}") - - except ProviderException as e: - self.log.warning(f"Error while processing station '{fga_id}': {e}") - except Exception as e: - self.log.exception(f"Error while processing station '{fga_id}': {e}") - self.log.info("...Done Type2 via Meteo Oberwallis!") - - lw_url = "http://www.lorawista.ch/data/{}.xml" - - lw_stations = [ - ["bitsch", "bitsch"], - ] - - def process_data_lw(self): - self.log.info("Processing LoRaWiSta Data...") - for fga_id, fga_path in self.lw_stations: - try: - response = requests.get(self.lw_url.format(fga_path), timeout=(self.connect_timeout, self.read_timeout)) - parser = LorawistaParser(response.text) - - station = self.save_station( - fga_id, - parser.name(), - parser.name(), - parser.latitude(), - parser.longitude(), - StationStatus.GREEN, - altitude=parser.elevation(), - ) +def dms2dd(degrees, minutes, seconds, direction): + dd = float(degrees) + float(minutes) / 60 + float(seconds) / (60 * 60) + if direction == "W" or direction == "S": + dd *= -1 + return dd - measures_collection = self.measures_collection(station["_id"]) - key = parser.key() - if not self.has_measure(measures_collection, key): - try: - measure = self.create_measure( - station, - key, - parser.direction(), - parser.speed(), - parser.speed_max(), - temperature=parser.temperature(), - humidity=parser.humidity(), - ) - self.insert_new_measures(measures_collection, station, [measure]) - except ProviderException as e: - self.log.warning(f"Error while processing measure '{key}' for station '{fga_id}': {e}") - except Exception as e: - self.log.exception(f"Error while processing measure '{key}' for station '{fga_id}': {e}") +def parse_dms(dms): + parts = dd_pattern.match(dms).groups() + lat = dms2dd(parts[0], parts[1], 0, parts[2]) + return lat - except ProviderException as e: - self.log.warning(f"Error while processing station '{fga_id}': {e}") - except Exception as e: - self.log.exception(f"Error while processing station '{fga_id}': {e}") - self.log.info("...Done Lorawista") +class FgaType1StationParser: + url_pattern = "https://meteo-oberwallis.ch/wetter/{}/daten.xml" + def __init__(self, path): + self.url = self.url_pattern.format(path) + self._station = None -class FgaStationParser: - def __init__(self, response): - self._fga_station = ET.fromstring(response.encode("utf-8")).find("./station") + def parse(self, connect_timeout, read_timeout): + response = requests.get(self.url, timeout=(connect_timeout, read_timeout)) + self._station = ET.fromstring(response.content).find("./station") def name(self): return self._get_value("./station/station") @@ -208,15 +73,34 @@ def humidity(self): return self._get_value("./humidity/humidity") def _get_value(self, path): - element = self._fga_station.find(path) + element = self._station.find(path) if element is None: return None return element.attrib.get("value") -class FgaStationParserType2: - def __init__(self, response): - self._fga_station = ET.fromstring(response.encode("utf-8")).find("./station") +class FgaType2StationParser: + url_pattern = "https://meteo-oberwallis.ch/wetter/{}/daten.xml" + + def __init__(self, path, name, lon, lat): + self.url = self.url_pattern.format(path) + self.station_name = name + self.lon = lon + self.lat = lat + self._station = None + + def parse(self, connect_timeout, read_timeout): + response = requests.get(self.url, timeout=(connect_timeout, read_timeout)) + self._station = ET.fromstring(response.content).find("./station") + + def name(self): + return self.station_name + + def longitude(self): + return self.lon + + def latitude(self): + return self.lat def elevation(self): return self._get_value("./elevation/elevation") @@ -244,69 +128,124 @@ def humidity(self): return self._get_value("./humidity/humidity") def _get_value(self, path): - element = self._fga_station.find(path) + element = self._station.find(path) if element is None: return None return element.attrib.get("value") class LorawistaParser: - def __init__(self, response): - self._lw_station = ET.fromstring(response.encode("utf-8")) + url_pattern = "http://www.lorawista.ch/data/{}.xml" # This URL is protected by an IPs whitelisting + + def __init__(self, path): + self.url = self.url_pattern.format(path) + self._station = None + + def parse(self, connect_timeout, read_timeout): + response = requests.get(self.url, timeout=(connect_timeout, read_timeout)) + self._station = ET.fromstring(response.content) def name(self): - return self._lw_station.findtext("stationname") + return self._station.findtext("stationname") def longitude(self): - return self._lw_station.findtext("stationlongitude") + return self._station.findtext("stationlongitude") def latitude(self): - return self._lw_station.findtext("stationlatitude") + return self._station.findtext("stationlatitude") def elevation(self): - return self._lw_station.findtext("elevation") + return self._station.findtext("elevation") def key(self): - time = self._lw_station.findtext("timestamp") - return arrow.get(time, "YYYY-MM-DTH:mm:ss").replace(tzinfo=oberwallis_tz).int_timestamp + time = self._station.findtext("timestamp") + return arrow.get(time, "YYYY-MM-DTH:mm:ss.SZ").int_timestamp def direction(self): - return self._lw_station.findtext("winddir") + return self._station.findtext("winddir") def speed(self): - return self._lw_station.findtext("windspeed") + return self._station.findtext("windspeed") def speed_max(self): - return self._lw_station.findtext("windmax") + return self._station.findtext("windmax") + + def rain(self): + return None def temperature(self): - return self._lw_station.findtext("celsius") + return self._station.findtext("celsius") def humidity(self): - return self._lw_station.findtext("humid") + return self._station.findtext("humid") + + +class FluggruppeAletsch(Provider): + provider_code = "aletsch" + provider_name = "fluggruppe-aletsch.ch" + provider_url = "https://fluggruppe-aletsch.ch" + stations = [ + ("ried-brig", FgaType1StationParser("ried-brig/XML")), + ("blitzingu", FgaType1StationParser("blitzingu/XML")), + ("bellwald", FgaType1StationParser("bellwald/XML")), + ("fieschertal", FgaType1StationParser("fiesch/XML")), + ("chaeserstatt", FgaType1StationParser("chaeserstatt/XML")), + ("jeizinen", FgaType1StationParser("jeizinen/XML")), + ("grimsel", FgaType1StationParser("grimselpass/XML")), + ("rothorli", FgaType2StationParser("rothorli", "Visperterminen Rothorn", "7.938", "46.2497")), + ("klaena", FgaType2StationParser("klaena", "Rosswald Klaena", "8.0632", "46.3135")), + ("bitsch", LorawistaParser("bitsch")), + ] -dd_pattern = re.compile(r"(\d*)°.([\d\.]*)'.([ONWS]+)") + def process_data(self): + self.log.info("Processing Fluggruppe Aletsch data...") + for station_id, parser in self.stations: + try: + parser.parse(self.connect_timeout, self.read_timeout) + station = self.save_station( + station_id, + parser.name(), + parser.name(), + parser.latitude(), + parser.longitude(), + StationStatus.GREEN, + altitude=parser.elevation(), + ) -def dms2dd(degrees, minutes, seconds, direction): - dd = float(degrees) + float(minutes) / 60 + float(seconds) / (60 * 60) - if direction == "W" or direction == "S": - dd *= -1 - return dd + measures_collection = self.measures_collection(station["_id"]) + key = parser.key() + if not self.has_measure(measures_collection, key): + try: + measure = self.create_measure( + station, + key, + parser.direction(), + parser.speed(), + parser.speed_max(), + rain=parser.rain(), + temperature=parser.temperature(), + humidity=parser.humidity(), + ) + self.insert_new_measures(measures_collection, station, [measure]) + except ProviderException as e: + self.log.warning(f"Error while processing measure '{key}' for station '{station_id}': {e}") + except Exception as e: + self.log.exception(f"Error while processing measure '{key}' for station '{station_id}': {e}") -def parse_dms(dms): - parts = dd_pattern.match(dms).groups() - lat = dms2dd(parts[0], parts[1], 0, parts[2]) - return lat + except ProviderException as e: + self.log.warning(f"Error while processing station '{station_id}': {e}") + except Exception as e: + self.log.exception(f"Error while processing station '{station_id}': {e}") + + self.log.info("Done !") def fluggruppe_aletsch(): aletsch_provider = FluggruppeAletsch() aletsch_provider.process_data() - aletsch_provider.process_data2() - aletsch_provider.process_data_lw() if __name__ == "__main__": diff --git a/providers/iweathar.py b/providers/iweathar.py index 99df555..d54e119 100644 --- a/providers/iweathar.py +++ b/providers/iweathar.py @@ -80,7 +80,7 @@ def process_data(self): rain_attr = item.xpath("RAINFALL_MM") if rain_attr and rain_attr[0].text: - rain = Q_(rain_attr[0].text, ureg.liter / (ureg.meter ** 2)) + rain = Q_(rain_attr[0].text, ureg.liter / (ureg.meter**2)) else: rain = None diff --git a/providers/meteoswiss_opendata.py b/providers/meteoswiss_opendata.py index 3d0bb8c..ca1e228 100644 --- a/providers/meteoswiss_opendata.py +++ b/providers/meteoswiss_opendata.py @@ -160,7 +160,7 @@ def process_data(self): if meteoswiss_id in rain_data: # 1mm = 1 liter/m^2 rain = self.get_value( - rain_data[meteoswiss_id]["properties"], unit=ureg.liter / (ureg.meter ** 2) + rain_data[meteoswiss_id]["properties"], unit=ureg.liter / (ureg.meter**2) ) else: rain = None diff --git a/pyproject.toml b/pyproject.toml index ccbddef..1216102 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ pyproj = "3.3.0" pytz = "2021.3" requests = {extras = ["socks"], version = "2.27.1"} redis = "3.5.3" -sentry-sdk = "1.5.1" +sentry-sdk = "1.5.8" scikit-learn = "1.0.2" scipy = "1.7.3" tenacity = "8.0.1" @@ -35,7 +35,7 @@ tzlocal = "2.1" xmltodict = "0.12.0" [tool.poetry.dev-dependencies] -black = "21.12b0" +black = "22.1.0" flake8 = "4.0.1" pytest = "6.2.5" python-dotenv = "^0.19.2" diff --git a/winds_mobi_provider/provider.py b/winds_mobi_provider/provider.py index 897bdff..a9cb93f 100644 --- a/winds_mobi_provider/provider.py +++ b/winds_mobi_provider/provider.py @@ -129,7 +129,7 @@ def __to_altitude(self, value): def __to_rain(self, value): if isinstance(value, ureg.Quantity): - return to_float(value.to(ureg.liter / (ureg.meter ** 2)).magnitude, 1) + return to_float(value.to(ureg.liter / (ureg.meter**2)).magnitude, 1) else: return to_float(value, 1)