Skip to content

Running app against slow server timesout #20

@hanthor

Description

@hanthor

raw_data = http_get(url)

➜ matomo_pull (main) ✗ python3 -c "import main; import os; os.environ['JWT_SECRET_KEY']='anonymous'; main.exec()"
Traceback (most recent call last):
File "/Users/james/Projects/matomo_pull/matomo_pull/url_handling.py", line 40, in http_get
response = json.loads(s.http.request("GET", url).data.decode('utf-8'))
File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/Users/james/Projects/matomo_pull/main.py", line 16, in exec
data_objects = data_handling.set_data_objects_for_sql_conversion(
File "/Users/james/Projects/matomo_pull/matomo_pull/data_handling.py", line 8, in set_data_objects_for_sql_conversion
data_objects[table_name] = set_data_object_from_url(
File "/Users/james/Projects/matomo_pull/matomo_pull/data_handling.py", line 26, in set_data_object_from_url
data = http_get(set_url(table_name))
File "/Users/james/Projects/matomo_pull/matomo_pull/url_handling.py", line 42, in http_get
raise ValueError(f"Request returns unhandable data: {url}")
ValueError: Request returns unhandable data

I'm able to load the URL and get the json response, it just take ~5 seconds. Can you advise on how to add in a wait or something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions