# 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
1. token
#### Mail + Password
```python
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
```python
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
```python
data = client.user_data
nickname = data['nickname']
uid = data['uid']
```
### Creating a drop group
```python
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
```python
client.get_drop_groups(12345)
```
If you don't own the map, use `get_public_drop_groups()`
### Exporting drops
```python
client.get_map_drops(12345)
```
or
```python
client.get_group_drops(12345)
```
You DON'T need to own the map or the group.
### Importing drops
```python
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`.
Raw data
{
"_id": null,
"home_page": null,
"name": "gt-api",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": "Adam Jenca <jenca.adam@gmail.com>",
"keywords": "geotastic, api",
"author": null,
"author_email": "Adam Jenca <jenca.adam@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e3/76/f41c09eaafb5272ac298ee8cdba2f4715c029bdf1277c05a0a0bcd65a617/gt_api-0.0.7.tar.gz",
"platform": null,
"description": "# geotastic-api\n\n## Installation\n\n```\npython3 -m pip install gt_api\n```\n(also installs requirements)\n\n## Usage\n\n### Logging in\n\nMost API requests require logging in. There are two ways to do it: \n\n1. mail + password\n1. token\n\n#### Mail + Password\n\n```python\nimport gt_api\nclient=gt_api.Client.login('your.mail@example.com', 'hunter2')\n```\n\nAnd you're in! The big caveat is that this logs you out of any other sessions, and also causes API costs.\nSo for most use cases you want to use tokens.\n\n#### Token\n\n```python\nimport gt_api\nclient=gt_api.Client('d8f350a3f557adc253f5003a81d3098c06dea93f84edf10e3fabc1d92acd1771')\n```\n\n##### How do I get it?\n\nGo to geotastic and log in with your account.\nThen 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.\n\nPlease 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.\n#### Without Login\n\nUse `Client(None)`.\nMost functions will not work.\n#### Accessing user data\n```python\ndata = client.user_data\nnickname = data['nickname']\nuid = data['uid']\n```\n### Creating a drop group\n\n```python\nmap_id=12345\ngroup = client.create_drop_group(map_id, -12.345, -69.420, 'pe', 'My Drop Group', active=True, bias=5.3)\nprint(group[\"dropGroup\"][\"id\"])\n```\n\n### Listing drop groups\n\n```python\nclient.get_drop_groups(12345)\n```\nIf you don't own the map, use `get_public_drop_groups()`\n\n### Exporting drops\n\n```python\nclient.get_map_drops(12345)\n```\nor\n```python\nclient.get_group_drops(12345)\n```\nYou DON'T need to own the map or the group.\n\n### Importing drops\n\n```python\ndrops=[{\"id\":1,\"style\":\"streetview\",\"lat\":39.28719501248246,\"lng\":-103.07696260471509,\"code\":\"us\",\"panoId\":\"Ple0qA2-cNzxc0K-gXgbFA\"}]\nclient.import_drops(drops, 12345, target_type=\"map\", import_type=\"merge\")\n```\n\nPossible target types are `map` and `group`.\nPossible import types are `merge`, `override` and `update`.\n\n### Lobbies\n\nLobbies are handled a little differently.\nTo create a lobby, use `Lobby.create(token)`.\nTo join a lobby, user `Lobby.join(token, lobby_id)`.\nYou 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.\nYou can send socket messages to the lobby using `lobby.send_message(type, **kwargs)`. The kwargs will be added to the message json.\nYou can make lobby api requests using `lobby.lobby_api_request(url, method *args, **kwargs)`. Args and kwargs will be passed to `request.request()`.\nTo run the lobby event loop, use `Lobby.run()`\nTo disconnect from the lobby, use `Lobby.disconnect()`\nLook at `examples/auto_lobby.py`\n### Other uses\n\nThere's loads more I can't be bothered to document. Check the source code.\n\n\n## Contributing\n\nIf 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).\n\nIf 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`.\n\n\n",
"bugtrack_url": null,
"license": "DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n Version 2, December 2004\n \n Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>\n \n Everyone is permitted to copy and distribute verbatim or modified\n copies of this license document, and changing it is allowed as long\n as the name is changed.\n \n DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n \n 0. You just DO WHAT THE FUCK YOU WANT TO.\n ",
"summary": "Geotastic internal API wrapper",
"version": "0.0.7",
"project_urls": {
"Bug Reports": "https://github.com/jenca-adam/geotastic_api/issues",
"Homepage": "https://github.com/jenca-adam/geotastic_api",
"Source": "https://github.com/jenca-adam/geotastic_api"
},
"split_keywords": [
"geotastic",
" api"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "93112b2d352402b4d209f640a34d7a3d3bbb7846dd12246312806ee89fb7e3b6",
"md5": "ebd5e4b0036d8f36a4753598962163d9",
"sha256": "0d4a9d49a20677010eb926a33ed98bb89430b0bdd3f932d829ffe90073bbfb59"
},
"downloads": -1,
"filename": "gt_api-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ebd5e4b0036d8f36a4753598962163d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12516,
"upload_time": "2025-08-24T08:19:38",
"upload_time_iso_8601": "2025-08-24T08:19:38.712421Z",
"url": "https://files.pythonhosted.org/packages/93/11/2b2d352402b4d209f640a34d7a3d3bbb7846dd12246312806ee89fb7e3b6/gt_api-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e376f41c09eaafb5272ac298ee8cdba2f4715c029bdf1277c05a0a0bcd65a617",
"md5": "69fe26ca3cc2688faa6fd2cb1cc58340",
"sha256": "02f9057da808721cc438e682b70c57a2202b72005c5163ee49906dad0324d246"
},
"downloads": -1,
"filename": "gt_api-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "69fe26ca3cc2688faa6fd2cb1cc58340",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10630,
"upload_time": "2025-08-24T08:19:39",
"upload_time_iso_8601": "2025-08-24T08:19:39.662140Z",
"url": "https://files.pythonhosted.org/packages/e3/76/f41c09eaafb5272ac298ee8cdba2f4715c029bdf1277c05a0a0bcd65a617/gt_api-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-24 08:19:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jenca-adam",
"github_project": "geotastic_api",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "gt-api"
}