Skip to main content

Geotastic internal API wrapper

Project description

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:

  1. mail + password
  2. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gt_api-0.308.4.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gt_api-0.308.4.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file gt_api-0.308.4.1.tar.gz.

File metadata

  • Download URL: gt_api-0.308.4.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gt_api-0.308.4.1.tar.gz
Algorithm Hash digest
SHA256 4ed5c2bd7ca0866c4a3236826d3fd46b269c2c654f45f1b166600e964ec327f2
MD5 ff77800acf9c93b39c4f82b33989dc74
BLAKE2b-256 f5c13494de8f5c962f49f82a0b279ccb785251b90474d905615cd6594fb3bb10

See more details on using hashes here.

File details

Details for the file gt_api-0.308.4.1-py3-none-any.whl.

File metadata

  • Download URL: gt_api-0.308.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gt_api-0.308.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6638b622b4a54a5679ccd0c4e198a27947bd6769ebeb1a0038989e94fb625925
MD5 2bcb789b9db15a9fbbbc358d8349995f
BLAKE2b-256 fb27d235b2a2cf246c9d3e78a16cbc9691a879749a7e5f9198cf74657de8b75f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page