Hello,
when I use code from readme.md i has clear output.
When try pt "client.authenticate()" on main() function, got error like this:
tractive.py:24: RuntimeWarning: coroutine 'Tractive.authenticate' was never awaited client.authenticate() RuntimeWarning: Enable tracemalloc to get the object allocation traceback
When add "await" before "client.authenticate()"
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/aiotractive/api.py", line 106, in authenticate
response.raise_for_status()
File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://graph.tractive.com/3/auth/token')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "tractive.py", line 31, in <module>
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "tractive.py", line 24, in main
await client.authenticate()
File "/usr/local/lib/python3.8/dist-packages/aiotractive/tractive.py", line 15, in authenticate
return await self._api.authenticate()
File "/usr/local/lib/python3.8/dist-packages/aiotractive/api.py", line 117, in authenticate
raise TractiveError from error
aiotractive.exceptions.TractiveError
My Python code:
1 import requests # For CURL request
2 import argparse # Args for Python scripts
3 import asyncio # Use for async function
4 from aiotractive import Tractive # Use for Tractive connection
5
6 # Initiate the parser
7 parser = argparse.ArgumentParser()
8
9 parser.add_argument("-email", help="Google e-mail", action="store")
10 parser.add_argument("-password", help="Google e-mail", action="store")
11 parser.add_argument("-traccar_server", help="traccar server", action="store")
12 parser.add_argument("-tractive_id", help="traccar server", action="store")
13
14 args = parser.parse_args()
15
16 EMAIL = args.email
17 PASSWORD = args.password
18 TRACCAR_SERVER = args.traccar_server
19 TRACTIVE_ID = args.tractive_id
20
21 async def main():
22 async with Tractive(EMAIL, PASSWORD) as client:
23 # interact with the client here
24 client.authenticate()
25 pass
26
27
28
29 if __name__ == "__main__":
30 asyncio.run(main())
31
Someone can share with me property use of this library for Tractive? I need get only GPS from my GPS for dog.
Hello, when I use code from readme.md i has clear output.
When try pt "client.authenticate()" on main() function, got error like this:
tractive.py:24: RuntimeWarning: coroutine 'Tractive.authenticate' was never awaited client.authenticate() RuntimeWarning: Enable tracemalloc to get the object allocation traceback
When add "await" before "client.authenticate()"
My Python code:
Someone can share with me property use of this library for Tractive? I need get only GPS from my GPS for dog.