rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.21k stars 352 forks source link

days_ago being to high causes analytics to break (#FirstIssue) #517

Closed brentspine closed 3 months ago

brentspine commented 5 months ago

Describe the bug

Setting days_ago to a number to high causes exceptions when reading logs and breaks the analytics server

Steps to reproduce

Do something like twitch_miner.analytics(host="127.0.0.1", port=5000, refresh=5, days_ago=365*1000000)

Expected behavior

Not break

Operating system

Windows 10 Home N

Python version

3.11.9

Miner version

1.9.5

Other relevant software versions

No response

Logs

02/05/24 19:01:29 - ERROR - [log_exception]: Exception on /json/streamer.json [GET] Traceback (most recent call last): File "C:\Users\youbo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 1463, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\youbo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 872, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\youbo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 870, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\youbo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 855, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(*view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\youbo\OneDrive\Dokumente\Twitch-Channel-Points-Miner-v2\TwitchChannelPointsMiner\classes\AnalyticsServer.py", line 133, in read_json filtered_data = filter_datas(start_date, end_date, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\youbo\OneDrive\Dokumente\Twitch-Channel-Points-Miner-v2\TwitchChannelPointsMiner\classes\AnalyticsServer.py", line 46, in filter_datas datetime.strptime(start_date, "%Y-%m-%d").timestamp() 1000 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64qbz5n2kfra8p0\Lib_strptime.py", line 567, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64qbz5n2kfra8p0\Lib_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data 'NaN-NaN-NaN' does not match format '%Y-%m-%d'

Additional context

Solving issue myself