xero-python
xero-python copied to clipboard
get_employees causing error in deserializer.py
Hi, I am seeing this error when trying to fetch employees for an Organisation. It is not happening for ALL Organisations, only some. Not sure what's going on but I would love a workaround/fix so I can get my Flask app not to generate an Internal Server Error.
Thanks.
Traceback (most recent call last):
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\bella\Documents\GitHub\Python\CConnect\synx\main.py", line 714, in sync_employees
xero_tenant_empl_ll = xero_get_employees_for_tenant_ll(api_client, sovereign, 'CSynX', token, tenantid, tenantname)
File "C:\Users\bella\Documents\GitHub\Python\CConnect\synx\employees.py", line 89, in xero_get_employees_for_tenant_ll
read_employees = payroll_api.get_employees(tenantid, where=where)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\payrollau\api\payroll_au_api.py", line 754, in get_employees
return self.api_client.call_api(
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\__init__.py", line 350, in call_api
return self.__call_api(
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\__init__.py", line 213, in __call_api
return_data = self.deserialize(
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\__init__.py", line 246, in deserialize
return deserialize(response_type, data, response_model_finder)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\single_dispatch_str.py", line 90, in wrapper
return dispatch(key)(*args, **kw)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 58, in deserialize
return deserialize_model(model, data, model_finder)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 281, in deserialize_model kwargs[attr] = deserialize(attr_type, value, model_finder)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\single_dispatch_str.py", line 90, in wrapper
return dispatch(key)(*args, **kw)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 77, in deserialize_list
return [deserialize(sub_data_type, sub_data, model_finder) for sub_data in data]
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 77, in <listcomp>
return [deserialize(sub_data_type, sub_data, model_finder) for sub_data in data]
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\single_dispatch_str.py", line 90, in wrapper
return dispatch(key)(*args, **kw)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 58, in deserialize
return deserialize_model(model, data, model_finder)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 281, in deserialize_model kwargs[attr] = deserialize(attr_type, value, model_finder)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\single_dispatch_str.py", line 90, in wrapper
return dispatch(key)(*args, **kw)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 191, in deserialize_date_ms
ms_datetime = deserialize_datetime_ms(data_type, data, model_finder)
File "C:\Users\bella\AppData\Local\Programs\Python\Python39\lib\site-packages\xero_python\api_client\deserializer.py", line 252, in deserialize_datetime_ms
return datetime.datetime.fromtimestamp(timestamp_s, tz=tz_info)
OSError: [Errno 22] Invalid argument
Just to add, I am using the latest version 1.8.1 and the Date that seems to be causing this seems to be the Date of Birth of one of the employees, 04/04/1966. I wish I knew how to contribute a fix but I am able to provide any additional info needed regarding my data.