Skip to main content

Easy integration for UPS Turkey

Project description

Build Status Made With License Latest Relase

UPS Turkey

Python package for integrate UPS Turkey easily.

UPS Türkiye yutriçi gönderileri için ups.com/upsdeveloperkit'ten ayrı bir sistem kullanmaktadır. ups.com/upsdeveloperkit sadece yurtdışı gönderile için kullanılmaktadır. UPS Türkiye'nin API'ları ise WebService (SOAP) ile çalışmaktadır. Bu hafif python pakedi, UPS Türkiye'nin web servisini kolayca kullanabilmenize olanak sağlar.

UPS Türkiye'nin oluşturma(Createshipment V7) ve sorgulama(QueryPackageInfo) işlemleri için iki ayrı servisi bulunmaktadır.


Table of Contents


Installation

pip install ups-turkey

Usage

Inıtilaize Service

from ups_turkey import UPSService

ups = UPSService('CUSTOMER_NUMBER', 'USERNAME', 'PASSWORD')

Service Helpers

result = ups.create(**payload) # for "Createshipment V7" service
# or
result = ups.query(**payload) # for "QueryPackageInfo" service

Operartions resturn list of dict as ResultList[Result]. ResultList and Result have some helpers like below.

  • Result(dict)
    • Convert result to JSON: result.json()
    • Convert result to dictionary: result.dict()
    • Checks is result is have an error: result.is_success() returns bool. If you want to raise UPSException(ERROR_CODE, ERROR_DEFINATION) pass raise_exception=True param like result.is_success(raise_exception=True)
    • result.get_error() for getting result's error code and defination as tuple if has
  • ResultList(list)
    • Convert result to JSON: result.json()
    • Checks is any result in list is have an error: result.has_fail() returns bool. If you want to raise UPSException(ERROR_CODE, ERROR_DEFINATION) pass raise_exception=True param like result.has_fail(raise_exception=True)

Operations

List

  • Create Service
    • Cancel_Shipment_V1
    • CreateShipment_Type1
    • CreateShipment_Type2
    • CreateShipment_Type2TRT
    • CreateShipment_Type3
    • CreateShipment_Type3_XML
    • CreateShipment_Type3_ZPL
    • CreateShipment_Type3_ZPL_Types
    • CreateShipment_Type4
    • CustomerShipmentLimitDetail
    • OnDemandPickupRequest_Type1
    • TransferShipmentList_Type1
  • Query Service

Parameter Dictionary

ExpenseCode

Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).

CityCode

UPS tarafından tanımlıdır. Türkiye'deki şehirler için plaka numarası.

ThirdPartyAccountNumber

Navlun üçüncü bir şahıs tarafından ödeniyorsa, bu UPS müşteri hesap numarasıdır.

IdControlFlag

Gönderici kimlik teyidi ile teslimat talep ederse “1”, aksi takdirde “0”.

PhonePrealertFlag

Gönderici, alıcının teslimattan önce telefonla uyarılmasını talep ederse “1”, aksi halde “0”.

Examples

CreateShipment_Type2
payload = {
    'ShipmentInfo': {
        # Gönderen
        'ShipperAccountNumber': 'CUSTOMER_NUMBER',
        'ShipperName': 'ABC Ltd. Şti.',
        'ShipperContactName': 'Mehmet Yılmaz',
        'ShipperAddress': 'Huzur Mh. Barış Cd. No:99',
        'ShipperCityCode': 34, # UPS tarafından tanımlanmıştır. Türkiye'deki şehirler için resmi numara.
        'ShipperAreaCode': 5824, # UPS tarafından tanımlanmıştır.
        'ShipperPostalCode': '34000',
        'ShipperPhoneNumber': '0 212 000 00 00',
        'ShipperPhoneExtension': '',
        'ShipperMobilePhoneNumber': '',
        'ShipperEMail': 'info@firma.com',
        'ShipperExpenseCode': '', # Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).

        # Alıcı
        'ConsigneeAccountNumber': '',
        'ConsigneeName': 'Mehmet Yılmaz',
        'ConsigneeContactName': '',
        'ConsigneeAddress': 'Memleket Mh. Bilmemne Sk. No:1',
        'ConsigneeCityCode': 34, # UPS tarafından tanımlanmıştır. Türkiye'deki şehirler için resmi numara.
        'ConsigneeAreaCode': 1858, # UPS tarafından tanımlanmıştır.
        'ConsigneePostalCode': '34000',
        'ConsigneePhoneNumber': '',
        'ConsigneePhoneExtension': '',
        'ConsigneeMobilePhoneNumber': '05320000000',
        'ConsigneeEMail': 'musteri@eposta.com',
        'ConsigneeExpenseCode': '', # Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).

        # Gönderi
        'ServiceLevel': 3,
        'PaymentType': 2,
        'PackageType': 'K',
        'NumberOfPackages': 1,
        'CustomerReferance': 'SIPARISNO',
        'CustomerInvoiceNumber': 'EFATURA000000',
        'DeliveryNotificationEmail': '',
        'DescriptionOfGoods': 'SKU00000',
        'IdControlFlag': 0, # Gönderici kimlik teyidi ile teslimat talep ederse “1”, aksi takdirde “0”.
        'PhonePrealertFlag': 0, # Gönderici, alıcının teslimattan önce telefonla uyarılmasını talep ederse “1”, aksi halde “0”.
        'SmsToShipper': 0,
        'SmsToConsignee': 1,
        'InsuranceValue': 0.00, # Sigorta değeri. Müşteri tarafından beyan edilir.
        'InsuranceValueCurrency': 'TL', # TL, EUR, USD
        'ValueOfGoods': 0, # Ürün fiyatı. Müşteri tarafından beyan edilir.
        'ValueOfGoodsCurrency': 'TL', # TL, EUR, USD
        'ValueOfGoodsPaymentType': 1,
        'ThirdPartyAccountNumber': '', # Navlun üçüncü bir şahıs tarafından ödeniyorsa, bu UPS müşteri hesap numarasıdır.
        'ThirdPartyExpenseCode': '', # Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).
    },
    'ReturnLabelLink': True,
    'ReturnLabelImage': True
}

result = ups.create('CreateShipment_Type2', **payload)
GetShipmentInfoByTrackingNumber_V2
payload = {
    'InformationLevel': 1,
    'TrackingNumber': 'YOUR_TRACKING_NUMBER'
}
result = ups.query('GetShipmentInfoByTrackingNumber_V2', **payload)
GetTransactionsByTrackingNumber_V1
payload = {
    'InformationLevel': 1,
    'TrackingNumber': 'YOUR_TRACKING_NUMBER'
}

result = ups.query('GetTransactionsByTrackingNumber_V1', **payload)
GetTransactionsByList_V2
payload = {
    'InformationLevel': 1,
    'refList': {
        'referansType': 'WAYBILL_TYPE',
        'referansList': ['YOUR_UPSReferance_CODE']
    },
    'trnType': 'ALL_TRANSACTIONS'
}

result = ups.query('GetTransactionsByList_V2', **payload)
GetTiNTInformationByTrackingNumber_V1
payload = {
    'InformationLevel': 1,
    'TrackingNumber': '1ZE3184E6800393143'
}
result = ups.query('GetTiNTInformationByTrackingNumber_V1', **payload)

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

ups_turkey-0.2.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ups_turkey-0.2.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file ups_turkey-0.2.0.tar.gz.

File metadata

  • Download URL: ups_turkey-0.2.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for ups_turkey-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7d49fbac7b7a6310002d206f3a642836de1665be14cc665a9382418d8743b5dd
MD5 9752871e4e4aefce8601c9d5a230881b
BLAKE2b-256 ac5350b571fc04c55f6a302c91283408ad2f94d4da4747642c57c9bb6ec7de31

See more details on using hashes here.

File details

Details for the file ups_turkey-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ups_turkey-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for ups_turkey-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec96a3b74ce7239eac48659375af44c38d9c4ee873c8f88951abd977d44d89c4
MD5 74ac2ec13dd400d209c3e55266d36f8d
BLAKE2b-256 b35b43694c188301a235e0e625ad034f0199939e97dd48f487df2bdd8aa9ed17

See more details on using hashes here.

Supported by

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