Skip to main content

Python Versions PyPI Version PyPI Downloads

Build Status codecov Codacy Badge Codacy Badge Requirements Status

Stars License

Glovo Python Business API

Create, retrieve and track your Glovo orders trough their Business API.

Requirements

This package requires at least

  • requests 2.21.0
  • python 3.7

This package was not tested with prior versions of these packages but it can works as well.

Install

You can install via pip. Run the following command:

pip install glovo-api-python

Credentials

Create an account in Glovo (it can be created from the App). This api needs a credit card associated to your account. You can add one from your app and it will be used automatically for any order. In order to get your API credentials you should login in the desired environment and go to Credentials section on your profile.

Example ApiKey & ApiSecret:

api_key = '155761234946286'
api_secret = '767b4e2f48e4412d95a6eb1234bdc78b'

Usage

Simple usage looks like:

Initialize client

from glovo_api_python.client import Glovo

api_key = 'sample_api_key'
api_secret = 'sample_api_secret'

client = Glovo(api_key, api_secret)

Get working areas

From glovo docs

woking_areas = client.working_area.list()
print(working_areas)
# Will show this
# {
#     'status': 200,
#     'data': {
#         'workingAreas': [
#             {
#                 'code': 'ABJ',
#                 'polygons': [
#                     '<ENCODED POLYLINE>',
#                     '<ENCODED POLYLINE>'
#                 ],
#                 'workingTime': {
#                     'from': '09:00',
#                     'duration': 120
#                 }
#             }
#             <OTHER WORKING AREAS>
#         ]
#     }
# }

Estimate order price

From glovo docs

pickup_address = {
    "lat": -12.0563673,
    "lon": -76.9733736,
    "type": "PICKUP",
    "label": "Avenida los Cipreses, 140",
    "details": "Edificio Orbes, Piso 3, Oficina de Productos Angel Breña",
    "contactPhone": None,
    "contactPerson": None
}

delivery_address = {
    "lat": -12.055013,
    "lon": -77.03845849999999,
    "type": "DELIVERY",
    "label": "Avenida Inca Garcilaso de la Vega, 1250",
    "details": "Oficina 511",
    "contactPhone": None,
    "contactPerson": None
}

estimates_order_price = client.order.estimate({
    "scheduleTime": None,
    "description": "Some useful description",
    "addresses": [
        pickup_address,
        delivery_address
    ]
})
print(estimates_order_price)
# Will show this
# {
#     'status': 200,
#     'data': {
#         'total': {
#             'amount': 1260,
#             'currency': 'PEN'
#         }
#     }
# }

Create order

From glovo docs

pickup_address = {
    "lat": -12.0563673,
    "lon": -76.9733736,
    "type": "PICKUP",
    "label": "Avenida los Cipreses, 140",
    "details": "Edificio Orbes, Piso 3, Oficina de Productos Angel Breña",
    "contactPhone": None,
    "contactPerson": None
}

delivery_address = {
    "lat": -12.055013,
    "lon": -77.03845849999999,
    "type": "DELIVERY",
    "label": "Avenida Inca Garcilaso de la Vega, 1250",
    "details": "Oficina 511",
    "contactPhone": None,
    "contactPerson": None
}

placed_order = client.order.create({
    "scheduleTime": 12344566, # Set to None for immediate order
    "description": "Some useful description",
    "addresses": [
        pickup_address,
        delivery_address
    ]
})

print(placed_order)
# Will show this
# {
#     'status': 200,
#     'data': {
#         "id": 123456789,
#         "state": "SCHEDULED",
#         "scheduleTime": 12344566,
#         "description": "A 30cm by 30cm box",
#         "addresses": [
#             <PICKUP ADDRESS>,
#             <DELIVERY ADDRESS>,
#         ]
#     }
# }

Retrieve order

From glovo docs

order_id = 32678866
placed_order = client.order.read(order_id)

print(placed_order)
# Will show this
# {
#     'status': 200,
#     'data': {
#         'scheduleTime': None,
#         'description': 'Necesito enviar una llave',
#         'addresses': [
#             <PICKUP ADDRESS>,
#             <DELIVERY ADDRESS>,
#         ],
#         'id': '32678866',
#         'state': 'DELIVERED',
#         'reference': None
#     }
# }

Get order tracking

From glovo docs

order_id = 32678866
tracking = client.order.tracking(order_id)
print(tracking)
# Will show this
# {
#     "status": 200,
#     "data": {
#         "lat": -12.0704984,
#         "lon": -76.9816546
#     }
# }

Get courier contact

From glovo docs

order_id = 32678866
glover_info = client.order.glover_info(order_id)
print(glover_info)
# Will show this
# {
#     "status": 200,
#     "data": {
#         "courierName": "Courier names",
#         "phone": "+99999999999"
#     }
# }

Get orders

From glovo docs

start=12344566
end=12544566
order_list = client.order.list(data={'from': start, 'to': end})
print(order_list)
# Will show this
# {
#     "status": 200,
#     "data": [
#         {
#             "scheduleTime": null,
#             "description": "Useful description!",
#             "addresses": [
#                 <PICKUP ADDRESS>,
#                 <DELIVERY ADDRESS>,
#             ],
#             "id": "40304538",
#             "state": "DELIVERED",
#             "reference": null
#         },
#         <OTHER ORDERS>
#     ]
# }

Cancel order

From glovo docs

order_id = 32678866
canceled_order = client.order.cancel(order_id)
print(glover_info)
# Will show this
# {
#     status: 200,
#     data: {
#         "id": 32678866,
#         "state": "CANCELED",
#         "scheduleTime": 12344566,
#         "description": "A 30cm by 30cm box",
#         "addresses": [
#             <PICKUP ADDRESS>,
#             <DELIVERY ADDRESS>,
#         ]
#     }
# }

Metadata

Release files for glovo-api-python 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glovo-api-python 2.0.1
File Size Uploaded Provenance Actions
glovo-api-python-2.0.1.tar.gz 10.9 kB Without provenance Details for glovo-api-python-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glovo-api-python 2.0.1
File Interpreter ABI Platform Actions
glovo_api_python-2.0.1-py3-none-any.whl Python 3 none any Details for glovo_api_python-2.0.1-py3-none-any.whl

Total release size: 22.3 kB

Release files / glovo-api-python-2.0.1.tar.gz

Download URL glovo-api-python-2.0.1.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2f33cbffbf1b11406f63157b748f6ec1d1029a987e5ea01f6c1cd4fc430fcc46
BLAKE2b-256 checksum
How to use checksums
2a1f7c53ea8213f9813a670c4e065ee4e2fbaab76b65bf7cae5d9edb84087b54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/4.15.0-30deepin-generic

Release files / glovo_api_python-2.0.1-py3-none-any.whl

Download URL glovo_api_python-2.0.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a5906606a276ce6fd03dd3a67ec1b989332f69ab3f4474cf6385b7344969bf2
BLAKE2b-256 checksum
How to use checksums
e8565110c2c95efcfb5b2824dd2b1cbf55edc52f342d9e0341a3c6af70295b5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/4.15.0-30deepin-generic

Security for glovo-api-python 2.0.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page