anmol098 / waka-readme-stats

This GitHub action helps to add cool dev metrics to your github profile Readme
MIT License
3.39k stars 555 forks source link

Exception: Query 'https://wakatime.com/api/v1/users/current/all_time_since_today?api_key=***' failed to run by returning code of 202: 'message': 'Calculating stats for this user. Check back later.'} #450

Closed CLAvenger closed 1 year ago

CLAvenger commented 1 year ago

Describe the bug I find it difficult to describe what caused the bug.

To Reproduce Just check this log. https://github.com/CLAvenger/CLAvenger/actions/runs/4688633374/jobs/8309371038

Traceback (most recent call last):
  File "/waka-readme-stats/main.py", line 221, in <module>
    run(main())
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/waka-readme-stats/main.py", line 208, in main
    stats = await get_stats()
            ^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/main.py", line 163, in get_stats
    data = await DM.get_remote_json("waka_all")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/manager_download.py", line 202, in get_remote_json
    return await DownloadManager._get_remote_resource(resource, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/manager_download.py", line 193, in _get_remote_resource
    raise Exception(f"Query '{res.url}' failed to run by returning code of {res.status_code}: {res.json()}")
Exception: Query 'https://wakatime.com/api/v1/users/current/all_time_since_today?api_key=***' failed to run by returning code of 202: {'data': {'decimal': '0.00', 'digital': '0:00', 'is_up_to_date': False, 'percent_calculated': 0, 'range': {'end': '2023-04-13T15:59:59Z', 'end_date': '2023-04-13', 'end_text': 'Today', 'start': '2023-04-12T16:00:00Z', 'start_date': '2023-04-13', 'start_text': 'Today', 'timezone': 'Asia/Shanghai'}, 'text': '0 secs', 'timeout': 15, 'total_seconds': 0}, 'message': 'Calculating stats for this user. Check back later.'}
sys:1: RuntimeWarning: coroutine 'AsyncClient.get' was never awaited

Expected behavior To make everything work as it should.

Github repository link If applicable, please share the Github repository link.

CLAvenger commented 1 year ago

Well.Now it runs successfully. https://github.com/CLAvenger/CLAvenger/actions/runs/4695093562/jobs/8323913435

pseusys commented 1 year ago

Sometimes wakatime needs some time to process user data. Sadly, we can not impact this.

YuYang94724 commented 1 year ago

Sorry, so what's the solution.... I got this too.

CLAvenger commented 1 year ago

Sorry, so what's the solution.... I got this too.

Just try it again. It may need a few times.

yixiaojiu commented 1 year ago

Can this exception be caught and give a friendly error message? 😭