diff --git a/app/utils/meta.py b/app/utils/meta.py index a32a4515..18f7f87d 100644 --- a/app/utils/meta.py +++ b/app/utils/meta.py @@ -53,6 +53,11 @@ async def tokenize(request, url: str) -> tuple[str, bool]: response = await session.post( api, data={"url": default_url}, headers={"X-API-KEY": api_key} ) + if response.status >= 500: + settings.REMOTE_TRACKING_ERRORS += 1 + logger.info(f"Tracker error count: {settings.REMOTE_TRACKING_ERRORS}") + return default_url, False + data = await response.json() return data["url"], data["url"] != url diff --git a/poetry.lock b/poetry.lock index 91932724..cc4cc02c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -356,21 +356,20 @@ python-versions = "*" [[package]] name = "flask" -version = "1.1.2" +version = "2.0.2" description = "A simple framework for building complex web applications." category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.6" [package.dependencies] -click = ">=5.1" -itsdangerous = ">=0.24" -Jinja2 = ">=2.10.1" -Werkzeug = ">=0.15" +click = ">=7.1.2" +itsdangerous = ">=2.0" +Jinja2 = ">=3.0" +Werkzeug = ">=2.0" [package.extras] -dev = ["pytest", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"] -docs = ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"] +async = ["asgiref (>=3.2)"] dotenv = ["python-dotenv"] [[package]] @@ -679,7 +678,7 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "locust" -version = "1.6.0" +version = "2.5.1" description = "Developer friendly load testing framework" category = "dev" optional = false @@ -687,17 +686,19 @@ python-versions = ">=3.6" [package.dependencies] ConfigArgParse = ">=1.0" -flask = "1.1.2" +flask = ">=2.0.0" Flask-BasicAuth = ">=0.2.0" Flask-Cors = ">=3.0.10" gevent = ">=20.9.0" -geventhttpclient = ">=1.4.4" +geventhttpclient = ">=1.5.1" msgpack = ">=0.6.2" psutil = ">=5.6.7" pywin32 = {version = "*", markers = "sys_platform == \"win32\""} -pyzmq = ">=16.0.2" -requests = ">=2.9.1" -Werkzeug = ">=1.0.1" +pyzmq = ">=22.2.1" +requests = ">=2.23.0" +roundrobin = ">=0.0.2" +typing-extensions = ">=3.7.4.3" +Werkzeug = ">=2.0.0" [[package]] name = "markdown" @@ -1192,6 +1193,14 @@ python-versions = "*" [package.extras] dev = ["pytest"] +[[package]] +name = "roundrobin" +version = "0.0.2" +description = "Collection of roundrobin utilities" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "ruamel.yaml" version = "0.17.17" @@ -1524,7 +1533,7 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "1.1" python-versions = "^3.10" -content-hash = "678a6e0f8c03fd6e6e6a83f779ceb6d594e75a06c7717ded39a6a032ff208b14" +content-hash = "2eae1db0d02f9d54f1bbf8e1d0923a561681dfe3f05a15e9a623dada4f9ee9de" [metadata.files] aiocache = [ @@ -1811,8 +1820,8 @@ docopt = [ {file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"}, ] flask = [ - {file = "Flask-1.1.2-py2.py3-none-any.whl", hash = "sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557"}, - {file = "Flask-1.1.2.tar.gz", hash = "sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060"}, + {file = "Flask-2.0.2-py3-none-any.whl", hash = "sha256:cb90f62f1d8e4dc4621f52106613488b5ba826b2e1e10a33eac92f723093ab6a"}, + {file = "Flask-2.0.2.tar.gz", hash = "sha256:7b2fb8e934ddd50731893bdcdb00fc8c0315916f9fcd50d22c7cc1a95ab634e2"}, ] flask-basicauth = [ {file = "Flask-BasicAuth-0.2.0.tar.gz", hash = "sha256:df5ebd489dc0914c224419da059d991eb72988a01cdd4b956d52932ce7d501ff"}, @@ -2040,8 +2049,8 @@ jinja2 = [ {file = "Jinja2-3.0.2.tar.gz", hash = "sha256:827a0e32839ab1600d4eb1c4c33ec5a8edfbc5cb42dafa13b81f182f97784b45"}, ] locust = [ - {file = "locust-1.6.0-py3-none-any.whl", hash = "sha256:28e4846d1ac14b88a4f29641d7306108dc652964331bdb57cd2991a6140b0515"}, - {file = "locust-1.6.0.tar.gz", hash = "sha256:95715ed82173d77a338bd91af01814ad2a199ed076880a720c3bc95462b796b3"}, + {file = "locust-2.5.1-py3-none-any.whl", hash = "sha256:8527e0c4eff0b27f2368a96bd6036a379049d3efd17b7750ea1a54d5e23017fe"}, + {file = "locust-2.5.1.tar.gz", hash = "sha256:da04bcf2248d07e47a05a3997ffc54aaf3215f7f4ca87acf5b7ec65bbef92694"}, ] markdown = [ {file = "Markdown-3.2.2-py3-none-any.whl", hash = "sha256:c467cd6233885534bf0fe96e62e3cf46cfc1605112356c4f9981512b8174de59"}, @@ -2582,6 +2591,9 @@ rfc3986 = [ rope = [ {file = "rope-0.18.0.tar.gz", hash = "sha256:786b5c38c530d4846aa68a42604f61b4e69a493390e3ca11b88df0fbfdc3ed04"}, ] +roundrobin = [ + {file = "roundrobin-0.0.2.tar.gz", hash = "sha256:ac30cb78570a36bb0ce0db7b907af9394ec7a5610ece2ede072280e8dd867caa"}, +] "ruamel.yaml" = [ {file = "ruamel.yaml-0.17.17-py3-none-any.whl", hash = "sha256:9af3ec5d7f8065582f3aa841305465025d0afd26c5fb54e15b964e11838fc74f"}, {file = "ruamel.yaml-0.17.17.tar.gz", hash = "sha256:9751de4cbb57d4bfbf8fc394e125ed4a2f170fbff3dc3d78abf50be85924f8be"}, diff --git a/pyproject.toml b/pyproject.toml index 5b816a3b..8a270f27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,7 +61,7 @@ pytest-random = "*" pytest-rerunfailures = "^9.1" pytest-cov = "^2.7" sanic-testing = "^0.8.2" -locust = "^1.2.3" +locust = "^2.5.1" # Coverage coveragespace = "^4.2"