Skip to main content

django-starken

Starting

These instructions will allow you to install the library in your python project.

Current features

  • Get default payload.
  • Create shipping.

Pre-requisitos

  • Python >= 3.7
  • Django >= 3
  • requests >= 2

Installation

  1. To get the latest stable release from PyPi:
pip install django-starken

or

  1. From a build
git clone https://gitlab.com/linets/ecommerce/oms/integrations/django-starken
cd {{project}}
python setup.py sdist

and, install in your project django

pip install {{path}}/django-starken/dist/{{tar.gz file}}
  1. Settings in django project
DJANGO_STARKEN = {
    'STARKEN': {
        'BASE_URL': '<STARKEN_BASE_URL>',
        'RUT_USER': '<STARKEN_RUT_USER>',
        'PASS_USER': '<STARKEN_PASS_USER>',
        'DELIVERY_TYPE': '<STARKEN_DELIVERY_TYPE>',
    },
    'SENDER': {
        'RUT_COMPANY': '<STARKEN_RUT_COMPANY>',
        'CTA_CTE_NUMBER': '<STARKEN_CTA_CTE_NUMBER>',
        'DV_CTA_CTE_NUMBER': '<STARKEN_DV_CTA_CTE_NUMBER>',
        'CENTER_COST_CTA_CTE': '<STARKEN_CENTER_COST_CTA_CTE>',
        'DOCUMENT_TYPE': '<STARKEN_DOCUMENT_TYPE>',
        'GENERATE_LABEL_DOCUMENT_1': '<STARKEN_GENERATE_LABEL_DOCUMENT_1>',
        'TYPE_ORDER_1': '<STARKEN_TYPE_ORDER_1>',
        'ORIGEN_CITY': <STARKEN_ORIGEN_CITY>,
    }
}

Usage

  1. Create instance to be sent

    import json
    from types import SimpleNamespace
    
    dict_ = {
        'reference': '99999',
        'delivery_date': '2018-12-06 13:00:00',
        'created_at': '12/12/21',
        'shipping_date': '12/12/21',
        'expiration_date': '26/12/21',
        'tracking_code': '6075620-1',
        'transport_guide_number': '1121632479536-01-1',
        'purchase_number': 'CLV0048146676851-1',
        'agency_id': '123',
        'items': [
            {
                'code': 'SKU1234',
                'name': 'POLOS',
                'price': '2500',
                'quantity': '2'
            },
            {
                'code': 'SKU12345',
                'name': 'SHORT',
                'price': '1500',
                'quantity': '1'
            }
        ],
        'customer': {
            'first_name': 'Marcos',
            'last_name': 'Sac',
            'full_name': 'Marcos Sac',
            'phone': '932932932',
            'email': 'test@gmail.com',
            'rut': '16936195-9'
        },
        'address': {
            'street': 'ALEJANDRO VENEGAS CADIZ',
            'number': '513',
            'unit': 'DEPTO 6A',
            'full_address': 'ALEJANDRO VENEGAS CADIZ 513 DEPTO 6A'
        },
        'commune': {
            'name': 'Aisen',
            'code': '',
            'zone_code': '11201',
            'zone_post': 'WPA',
        },
        'location': {
            'code': 'MONTANDON',
            'name': 'MNN',
        },
        'region': {
            'name': 'Aysén del General Carlos Ibáñez del Campo',
            'code': '11',
            'iso_code': 'CL-XI',
        }
    }
    
    instance = json.loads(json.dumps(dict_), object_hook=lambda attr: SimpleNamespace(**attr))
    
  2. Get default payload:

from starken.handler import StarkenHandler

handler = StarkenHandler()
default_data = handler.get_default_payload(<instance>)
  1. Create shipping:
from starken.handler import StarkenHandler

handler = StarkenHandler()
default_data = handler.create_shipping(<default_data>)
  1. Get events:
from starken.handler import StarkenHandler

handler = StarkenHandler()

raw_data = {
    'tracking_number': 999999,
    'status': 'Entregado',
    'events': [{
        'city': 'Santiago'
        'state': 'RM',
        'description': 'Llego al almacén',
        'date': '12/12/2021'
    }]
}
response = handler.get_events(raw_data)

Output:
[{
    'city': 'Santiago'
    'state': 'RM',
    'description': 'Llego al almacén',
    'date': '12/12/2021'
}]
  1. Get status and if "is_delivered":
from starken.handler import StarkenHandler

handler = StarkenHandler()

raw_data = {
    'tracking_number': 999999,
    'status': 'ENTREGADO',
    'events': [{
        'city': 'Santiago'
        'state': 'RM',
        'description': 'Llego al almacén',
        'date': '12/12/2021'
    }]
}
response = handler.get_status(raw_data)

Output:
('ENTREGADO', True)

Metadata

Release files for corona-starken-logistica 1.0.9

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

Source distribution (sdist)

Source distribution for corona-starken-logistica 1.0.9
File Size Uploaded Provenance
corona_starken_logistica-1.0.9.tar.gz 7.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for corona-starken-logistica 1.0.9
File Interpreter ABI Platform
corona_starken_logistica-1.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / corona_starken_logistica-1.0.9.tar.gz

Download URL corona_starken_logistica-1.0.9.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6dc453a69f0ea501302d832d4cfd2105b48712439b69afdb388c7d1618a88d68
BLAKE2b-256 checksum
How to use checksums
d00230f846cb53917e20c94f72a5985a6f4b5a73a1cbcd61161b9bba9dedf480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3

Release files / corona_starken_logistica-1.0.9-py3-none-any.whl

Download URL corona_starken_logistica-1.0.9-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afeefa4df88f7a410b1bfba6ca274919d08001c69dfe216e7bc685696b78bb3b
BLAKE2b-256 checksum
How to use checksums
43a57091b273a3368594fe27bdf66174db2769c764b464ddef6c13715abf3ad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3

Security for corona-starken-logistica 1.0.9

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.

Release history Release notifications | RSS feed

This release

1.0.9 This release

2 release files No provenance

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