GithubHelp home page GithubHelp logo

python_dhl_germany's Introduction

python_dhl_germany

New WSDL version

install dev

  • create venv: python -m venv venv
  • activate venv:
    • Windows: venv/Scripts/activate
    • Linux / Mac: source venv/bin/activate
  • pip install -r requirements.txt -r requirements_dev.txt
  • pre-commit hook install: pre-commit install --hook-type pre-push
  • create .env file and add DHL_AUTH_USER + DHL_AUTH_PASSWORD variables

build and deploy

  • python setup.py sdist bdist_wheel
  • s3pypi --bucket pypi.fourzero.one

usage

create dhl client:

dhl_client = DHL(
    "DHL_AUTH_USER", # test: DHL-Entwickler User / live: DHL App Name
    "DHL_AUTH_PASSWORD", # test: DHL-Entwickler PW / live: DHL App Token
    "API_USER", # test: 2222222222_01 / live: Geschäftskunden-Portal system user name
    "API_PASSWORD", # test: pass / live: Geschäftskunden-Portal system user pw
    is_test=True,
)

create shipment order:

shipper = {
    "name": "Something Something GmbH",
    "name2": "",
    "street": "Teststraße",
    "street_number": "32",
    "zip": "22222",
    "city": "Bremen",
    "country_code": "DE",
    "phone": "040251090",
    "email": "[email protected]",
    "contact_person": "Test User",
}

receiver = {
    "name": "Test Tester",
    "name2": "TestCompany",
    "street": "Teststraße",
    "street_number": "12",
    "zip": "28217",
    "city": "Bremen",
    "country_code": "DE",
    "careOfName": "",
}

order = {
    "customs": {
        "invoice_no": "1234567",
        "description": "Ziegelsteine",
        "place_of_commital": shipper["city"],
    },
    "positions": [
        {
            "name": "Test Product 1",
            "amount": 2,
            "price": 12.5,
            "weight": 0.15,
            "customs": {
                "country_code_origin": "DE",
                "customs_tariff_number": "49119900",
            },
        },
        {
            "name": "Test Product 2",
            "amount": 3,
            "price": 1.5,
            "weight": 100,
            "customs": {
                "country_code_origin": "DE",
                "customs_tariff_number": "49119900",
            },
        },
    ],
}

dhl_client.create_shipment_order(
    "ORDER_ID",
    shipper, # find example in integration test
    receiver, # find example in integration test
    6.0, # weight
    "V01PAK", # dhl product
    "22222222220101", # dhl account number
    order_to_ship=order, # find example in integration test
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.