Package: glovo-api-python
Glovo Python Business APICreate, retrieve and track your Glovo orders trough their Business API.RequirementsThis package requires at leastrequests 2.21.0python 3.7This package was not tested with prior versions of these packages but it can works as well.InstallYou can install via pip. Run the following command:pipinstallglovo-api-pythonCredentialsCreate an account in Glovo (it can be created from the App). This apineeds 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 toCredentialssection on your profile.B2B ProductionB2B Sandbox/TestExampleApiKey&ApiSecret:api_key='155761234946286'api_secret='767b4e2f48e4412d95a6eb1234bdc78b'UsageSimple usage looks like:Initialize clientfromglovo_api_python.clientimportGlovoapi_key='sample_api_key'api_secret='sample_api_secret'client=Glovo(api_key,api_secret)Get working areasFromglovo docswoking_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 priceFromglovo docspickup_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 orderFromglovo docspickup_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 orderFromglovo docsorder_id=32678866placed_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 trackingFromglovo docsorder_id=32678866tracking=client.order.tracking(order_id)print(tracking)# Will show this# {#     "status": 200,#     "data": {#         "lat": -12.0704984,#         "lon": -76.9816546#     }# }Get courier contactFromglovo docsorder_id=32678866glover_info=client.order.glover_info(order_id)print(glover_info)# Will show this# {#     "status": 200,#     "data": {#         "courierName": "Courier names",#         "phone": "+99999999999"#     }# }Get ordersFromglovo docsstart=12344566end=12544566order_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 orderFromglovo docsorder_id=32678866canceled_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>,#         ]#     }# }