geotastic-api
Installation
python3 -m pip install gt_api
(also installs requirements)
Usage
Logging in
Most API requests require logging in. There are two ways to do it:
- mail + password
- token
Mail + Password
import gt_api
client=gt_api.Client.login('your.mail@example.com', 'hunter2')
And you're in! The big caveat is that this logs you out of any other sessions, and also causes API costs. So for most use cases you want to use tokens.
Token
import gt_api
client=gt_api.Client('d8f350a3f557adc253f5003a81d3098c06dea93f84edf10e3fabc1d92acd1771')
How do I get it?
Go to geotastic and log in with your account. Then open the developer tools (F12 or ctrl-shift-i). Then navigate to Storage(Application->Storage for Chrome)->Local Storage->https://geotastic.net/ and scroll down to token. Copy the value.
Please note that the token is one per session, so once you log out of the session you got the token from, you'll need to update it.
Without Login
Use Client(None).
Most functions will not work.
Accessing user data
data = client.user_data
nickname = data['nickname']
uid = data['uid']
Creating a drop group
map_id=12345
group = client.create_drop_group(map_id, -12.345, -69.420, 'pe', 'My Drop Group', active=True, bias=5.3)
print(group["dropGroup"]["id"])
Listing drop groups
client.get_drop_groups(12345)
If you don't own the map, use get_public_drop_groups()
Exporting drops
client.get_map_drops(12345)
or
client.get_group_drops(12345)
You DON'T need to own the map or the group.
Importing drops
drops=[{"id":1,"style":"streetview","lat":39.28719501248246,"lng":-103.07696260471509,"code":"us","panoId":"Ple0qA2-cNzxc0K-gXgbFA"}]
client.import_drops(drops, 12345, target_type="map", import_type="merge")
Possible target types are map and group.
Possible import types are merge, override and update.
Lobbies
Lobbies are handled a little differently.
To create a lobby, use Lobby.create(token).
To join a lobby, user Lobby.join(token, lobby_id).
You then add handlers for events coming in from the Lobby socket using the lobby.add_handler("event") decorator. The handler for the event "*" will be called for every event.
You can send socket messages to the lobby using lobby.send_message(type, **kwargs). The kwargs will be added to the message json.
You can make lobby api requests using lobby.lobby_api_request(url, method *args, **kwargs). Args and kwargs will be passed to request.request().
To run the lobby event loop, use Lobby.run()
To disconnect from the lobby, use Lobby.disconnect()
Look at examples/auto_lobby.py
Other uses
There's loads more I can't be bothered to document. Check the source code.
Contributing
If you'd like to have a feature that's not in the library, just create a github issue and I'll get to it (maybe).
If you'd like to add your own, it's pretty easy. Just use developer tools to check which api calls geotastic is making and then remake them as functions. If the calls are encrypted, use gt_api.generic.decode_encdata.
Metadata
Release files for gt-api 0.319.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gt_api-0.319.0.tar.gz | 12.2 kB | Without provenance | Details for gt_api-0.319.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gt_api-0.319.0-py3-none-any.whl | Python 3 | none | any | Details for gt_api-0.319.0-py3-none-any.whl |
Total release size: 26.8 kB
Release files / gt_api-0.319.0.tar.gz
| Download URL | gt_api-0.319.0.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b752df14a76ae36d3ebf8e3513c7785436a37225fe8d921fbaeaa4d188558d2
|
|
BLAKE2b-256 checksum How to use checksums |
1c6d16cedd659bf4e007a602f376b0e6d4dba2edf7ae08cef4b6f2d99d2b185f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Release files / gt_api-0.319.0-py3-none-any.whl
| Download URL | gt_api-0.319.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ad31dd2859f2be169ccebee65f1e72839174e042a526260b1cc2fa06ce0d4b4
|
|
BLAKE2b-256 checksum How to use checksums |
3318acf0deec0840608125ac7a5e3d83ad64efd14455446b65674d9a2993b54a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Security for gt-api 0.319.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.