Skip to main content

Unoffical python client for TooGoodToGo API

Project description

Actions Status codecov

tgtg-python

Python client that help you to talk with TooGoodToGo API.

Python version: 3.6, 3.7, 3.8

Handle:

  • login
  • list stores (/item/)
  • get a store (/item/<pk>)
  • get all stores (/index.php/api_tgtg/list_all_business_map_v5_gz)

Used by:

Install

pip install tgtg

Use it

from tgtg import TgtgClient

# login with email and password
client = TgtgClient(email=your_email, password=your_password)

# or you can login with user_id and access_token
# (you can retrieve them from client after logged with email and password)
client = TgtgClient(access_token=your_access_token, user_id=your_user_id)

# You can then get some items, default will get **only** your favorites
client.get_items()

# To get items (not only your favorites) you need to provide location informations
client.get_items(
    favorites_only=False,
    latitude=48.126,
    longitude=-1.723,
    radius=10,
)

# Or get an item
client.get_item(1234)

# get all items **without** auth (with limited fields, used for the map in the app)
client = TgtgClient()
client.get_all_business()

Developers

This project use poetry so you will need to install locally poetry to use following commands.

pip install poetry --user
poetry install

This project use black to format all the code, isort to sort all imports and lint is done by flake8.

Just run this command to format automatically all the code you wrote:

make style

Run this command to run all tests:

make test

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

tgtg-0.1.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

tgtg-0.1.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file tgtg-0.1.2.tar.gz.

File metadata

  • Download URL: tgtg-0.1.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.9 Linux/4.15.0-96-generic

File hashes

Hashes for tgtg-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c74de59dd0338b7c77bb6dbaf5618308e3af7f59621d0a372c6ba76b462630e6
MD5 918159b75e98f6a1461a7da57bda5a98
BLAKE2b-256 361a9a2080eff16559c9c3e1eefe6bb81fac719779930e6f912fd58fd142c4d4

See more details on using hashes here.

File details

Details for the file tgtg-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tgtg-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.9 Linux/4.15.0-96-generic

File hashes

Hashes for tgtg-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 afed9ee501c1018b4e4611b5de23c9a07c8595f468c16c4f5259b7e6c5a7be1f
MD5 d6106e773e65163c564986a8c3d13d99
BLAKE2b-256 dee64949f1cdc7c6971433d3c1d203b9e62b7aafdeace2ee00516d2415af36e2

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