geotab / mygeotab-python Goto Github PK
View Code? Open in Web Editor NEWA Python client for the MyGeotab API.
Home Page: https://mygeotab-python.readthedocs.io
License: Apache License 2.0
A Python client for the MyGeotab API.
Home Page: https://mygeotab-python.readthedocs.io
License: Apache License 2.0
In the request for trips
, I get duration information (ex in the drivingDuration field) in a datetime.time
format, which should be reserved for a time of the day. I would assume this would throw errors for duration more than 24 hours but I think the API happens to return only duration < 24.
It is really annoying since I can't process the data directly since no operation are supported between datetime.time
objects. It would be great if duration could be parsed into a datetime.timedelta
instead,.
When authenticating with a Credentials object that is given a session_id
value and authenticating:
credentials = Credentials(username=..., database=..., server=..., session_id=...)
client = API.from_credentials(credentials)
The following error is returned:
{
error: {
code: -32000,
data: {},
errors: [
{
"message": "\"This method has been deprecated, and requires a custom code to be used. please use new methode 'ExtendSessionAsync' to extend your session.\"",
"name": "'ArgumentException'",
}
],
message: "This method has been deprecated, and requires a custom code to be used. please use new methode 'ExtendSessionAsync' to extend your session.",
name: "JSONRPCError",
},
id: -1,
jsonrpc: "2.0",
requestIndex: 0,
}
Details from GeoTab Community:
https://community.geotab.com/s/question/0D52J00009iEouYSAS/fail-to-authenticate-method-has-been-deprecated?language=en_US
mygeotab
version: 0.8.8
API class doesn't appear to accept a cipher list
Trying to get the "WorkTime" Entities and the get method is throwing an error:
import mygeotab
client = mygeotab.API(username=username, password=password, database=database)
client.authenticate()
print(client.call('GetVersion')) # 8.0.2441
data = client.get('WorkTime')
Trying to get the "WorkTimeDetail" Entities and the get method is throwing an error:
import mygeotab
client = mygeotab.API(username=username, password=password, database=database)
client.authenticate()
print(client.call('GetVersion')) # 8.0.2441
data = client.get('WorkTimeDetail')
MyGeotabException: NotSupportedException
Cannot find bridge for Geotab.Checkmate.ObjectModel.WorkTimeDetail Path: $.Result.
Edit: Seeing this says "NotSupportedException". Will this be supported in the future?
I'm trying to export the Driver list using the API client, but am getting an InvaliCastException:
import mygeotab
client = mygeotab.API(username=username, password=password, database=database)
client.authenticate()
print(client.call('GetVersion')) # 8.0.2441
data = client.get('Driver')
MyGeotabException: InvalidCastException
Unable to cast object of type 'Geotab.Checkmate.Database.Bridge.UserBridge' to type 'Geotab.Database.IGetStore`1[Geotab.Checkmate.ObjectModel.Driver]'.
I keep getting an exception when trying to query with the following parameters:
self.__client.call(
"GetFeed",
typeName="LogRecord",
search={
"deviceSearch": {
"id": device_id,
},
"fromDate": "2023-02-06 16:00:32 UTC",
"toDate": "2023-02-06 16:10:32 UTC"
},
resultsLimit=10
)
Here is the exception:
Exception of type 'Geotab.Serialization.JsonSerializerException' was thrown.
Using mygeotab
version 0.8.8
and python version 3.9.13
.
This was working like a day ago and isn't anymore. Any recent code changes to the API that could be causing this? Doing a Get
to DeviceStatusInfo
doesn't seem to be affected.
Hi,
I am getting ssl error during authentication. I have version 0.9.0, but same thing was happening with 0.8.8.
Host OS: Archlinux (up to date)
python: 3.12
Freshly created venv with mygeotab
installed using pip
.
I am not sure why certificate verify failed: unable to get local issuer certificate
is happening.
When I try requests.get("https://my.geotab.com")
everything works fine. So I think ssl works fine.
Maybe it's not relevant, but tests in CI are failing for quite some time and it also fails on authentication.
Traceback (most recent call last):
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/connection.py", line 653, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/connection.py", line 806, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 465, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 509, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/ssl.py", line 1042, in _create
self.do_handshake()
File "/usr/lib/python3.12/ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/geotab_venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 847, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='my.geotab.com', port=443): Max retries exceeded with url: /apiv1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/devel/scripts/./geotab_receive_mime.py", line 10, in <module>
client.authenticate()
File "/home/user/geotab_venv/lib/python3.12/site-packages/mygeotab/api.py", line 259, in authenticate
result = _query(
^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/mygeotab/api.py", line 393, in _query
response = session.post(
^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/requests/sessions.py", line 637, in post
return self.request("POST", url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/geotab_venv/lib/python3.12/site-packages/requests/adapters.py", line 698, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='my.geotab.com', port=443): Max retries exceeded with url: /apiv1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))
Your documentation and git hub don't appear to be in sync.
When did you commit 0.9.0?
As of today, 240216, the latest github tag is v0.8.8.
That said, your documentation claims you commited v0.9.0 on 240208.
https://github.com/Geotab/mygeotab-python
https://mygeotab-python.readthedocs.io/en/latest/#id1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.