Skip to main content

Python Versions PyPI Version PyPI Downloads

Build Status codecov Codacy Badge Codacy Badge

Stars License

Running Box Python API

Estimate, create, and track your Running Box orders trough their 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 runningbox-api-python

Credentials

Get in touch with Runningbox and request your account. They will give you an API_KEY asociated to your tax id (BROKER_TAX_ID).

Example API_KEY & BROKER_TAX_ID:

api_key = 'XiX7X46D4rKyCy6pGOCLOg=='
broker_tax_id = '123456790'

Usage

Simple usage looks like:

Initialize client

from runningbox_api_python.client import Client

api_key = 'sample_api_key'
broker_tax_id = 'sample_broker_tax_id'

client = Client(apapi_key, apbroker_tax_id)

Estimate order price

from runningbox_api_python.constants import Service

estimated_order_price = client.order.estimate(
    {
        'ubigeo': '150131',   # Ubigeo code acording to INEI
        'servicio': Service.EXPRESS,   # Service type
        'peso': '43.00'   # Weight of your package
    }
)
print(estimates_order_price)
# Will show this
# {
#     'status': 200,
#     'data': 55.4
# }

Note

  • The value under 'data' label is the price in PEN

Create order

placed_order = client.order.create({
    # Cliente de envio
    "cliente": "Customer Inc.",
    "cliente_ruc": "20601826535",
    "nro_pedido": "CUSTOMER-d98b73bffdd54685a3c40c544a539668",
    "piezas": "10",
    "imp_seguro": "",
    "descripcion": "Sample description",
    "peso": "10.0",
    "cod": "",
    "dd": "",
    "importe_cod": "0.00",
    "servicio": Service.EXPRESS,

    # Cliente final
    "cliente_final": "Jhon Doe",
    "tipo_doc": "1",
    "numero_doc": "123456789",

    # "documento1": "",
    # "nrodoc1":"",
    # "documento2":"",
    # "nrodoc2":"",
    # "documento3":"",
    # "nrodoc3":"",
    # "documento4":"",
    # "nrodoc4":"",

    # Entrega
    "ubigeo": "150101",
    "departamento": "Lima",
    "provincia": "Lima",
    "distrito": "Lima",
    "direccion": "jr la mar 1000",
    "observacion": "",
    "mail": "jhon.doe@example.com",
    "telefono": "999999999",
    "contacto": "Margery Doe (999999998)",

    # Recojo
    "nombre_resp_almacen": "Donnald Doe (999999997)",
    "dni_resp_almacen": "123456788",
    "telefono_resp_almacen": "999999997",
    "arco_resp_almacen": "8:00 - 19:00",
    "direccion_almacen": "Sample Address 777, No where.",
    "ubigeo_almacen": "150132",
    "flag_inversa": 0,
    "flag_canal": 1,
    "notas": "",
    "productos": [
        {
            "nombre": "delirium - bvd hombre addiction - talla : xl - color : azul y negro",
            "descripcion": "delirium-bvd-hombre-addiction-1-018171",
            "sku": "dbh-add-blrj-xl",
            "peso": 10
        }
    ]
})

print(placed_order)
# Will show this
# {
#     'status': 200,
#     'data': {
#         'ID_OS': 408453,
#         'NRO_ORDEN': '1000362049',
#         'ID_RSPTA': 71,
#         'DES_RSPTA': 'CREADO',
#         'FECHA': '11/24/2019 2:39:29 AM'
#     }
# }

Get order tracking

Order tracking can be done with nro_pedido parameter that you used to create your order.

request_number = 'CUSTOMER-d98b73bffdd54685a3c40c544a539668'
tracking = client.order.tracking(request_number)
print(tracking)
# Will show this
# {
#     'status': 200,
#     'data': [
#         {
#             'NRO_OS': '1000362049',
#             'CLIENTE': 'Customer Inc.',
#             'ID_CPOINT': '71',
#             'DES_CPOINT': 'CREADO',
#             'FECHA': '24/11/2019',
#             'HORA': '02:39:29',
#             'OBSERVACION': ''
#         }
#     ]
# }

Or with nro_orden parameter that you get after create your order.

order_number = '1000362049'
tracking = client.order.tracking(order_number)
print(tracking)
# Will show this
# {
#     'status': 200,
#     'data': [
#         {
#             'NRO_OS': '1000362049',
#             'CLIENTE': 'Customer Inc.',
#             'ID_CPOINT': '71',
#             'DES_CPOINT': 'CREADO',
#             'FECHA': '24/11/2019',
#             'HORA': '02:39:29',
#             'OBSERVACION': ''
#         }
#     ]
# }

Note

  • The value under 'data' label is a list of events that take place in the delivery process.

Metadata

Release files for runningbox-api-python 1.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 runningbox-api-python 1.0.1
File Size Uploaded Provenance
runningbox-api-python-1.0.1.tar.gz 9.8 kB Without provenance Details

Release files / runningbox-api-python-1.0.1.tar.gz

Download URL runningbox-api-python-1.0.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
725f52ca2cd93ec0f69a4e85151d81e8f9c739d9830ba9336519b5a5ad6de98b
BLAKE2b-256 checksum
How to use checksums
683f0bc88c23ce93ca2666589a3510a440562948963e8937e7ee0be68aa2a937
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

Security for runningbox-api-python 1.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