Skip to main content

Running Box API Python

Project description

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.

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

runningbox-api-python-1.0.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

runningbox_api_python-1.0.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file runningbox-api-python-1.0.0.tar.gz.

File metadata

  • Download URL: runningbox-api-python-1.0.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.3

File hashes

Hashes for runningbox-api-python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 58c56348209bf12077a592a43af39f3e371f10cd5279bd55da1124e591c45041
MD5 d08fefdb6c4e382e98c3ca7213c3bfa8
BLAKE2b-256 75f22725be3874c98bf9c9f88a553e80c735bf041748eef3a08ff2987ac95146

See more details on using hashes here.

File details

Details for the file runningbox_api_python-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: runningbox_api_python-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.3

File hashes

Hashes for runningbox_api_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c44af4dff88dc77adc8dccb09d5f55133b544eb3e25967f1467a290396377a67
MD5 2585cf89340f99da16ebd1f6624345ff
BLAKE2b-256 098183e1224901983501c71d1942a7b13e1c1f4ed2ba7cf62e795216504624a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page