File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ This repository contains the Python library for using implementing the different
77 alt="Project Status"
88 src="https://img.shields.io/badge/Project%20Status-beta-orange "
99 >
10+ <img
11+ alt="GitHub Workflow Status"
12+ src="https://img.shields.io/github/actions/workflow/status/EnAccess/OpenPAYGO-python/ci-cd.yml "
13+ >
1014 <a href="https://github.com/EnAccess/OpenPAYGO-python/blob/main/LICENSE" target="_blank">
1115 <img
1216 alt="License"
@@ -313,6 +317,9 @@ def device_data():
313317
314318## Changelog
315319
320+ ### 2023-10-13 - v0.5.4
321+ - Safe handling of datetime before UNIX timestamp minimum when generating answer timestamp
322+
316323### 2023-10-13 - v0.5.3
317324- Fix handling of ` last_request_timestamp ` when checking auth
318325
Original file line number Diff line number Diff line change @@ -103,9 +103,14 @@ def expects_time_answer(self):
103103 def add_time_to_answer (self , target_datetime ):
104104 data = self ._get_simple_data ()
105105 if data .get ('active_until_timestamp_requested' , False ):
106- self .response_dict ['active_until_timestamp' ] = target_datetime .timestamp ()
106+ target_timestamp = 0
107+ if target_datetime :
108+ if target_datetime .year > 1970 :
109+ target_timestamp = target_datetime .timestamp ()
110+ self .response_dict ['active_until_timestamp' ] = target_timestamp
107111 elif data .get ('active_seconds_left_requested' , False ):
108- self .response_dict ['active_seconds_left' ] = (datetime .now () - target_datetime ).total_seconds ()
112+ seconds_left = (datetime .now () - target_datetime ).total_seconds () if target_datetime else 0
113+ self .response_dict ['active_seconds_left' ] = seconds_left if seconds_left > 0 else 0
109114 else :
110115 raise ValueError ('No time requested' )
111116
Original file line number Diff line number Diff line change 11[metadata]
22name = openpaygo
3- version = 0.5.3
3+ version = 0.5.4
44description = OpenPAYGO library in Python
55long_description = file: README.md
66long_description_content_type = text/markdown
You can’t perform that action at this time.
0 commit comments