Easy integration for UPS Turkey
Project description
UPS Turkey
Python package for integrate UPS Turkey easily.
Install
pip install ups-turkey
Usage
Create Shipment
from ups_turkey import UPSService
ups = UPSService('CUSTOMER_NUMBER', 'USERNAME', 'PASSWORD')
shipment_info = {
'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
}
shipment = ups.CreateShipment_Type2(shipment_info, True, True)
Get Shipment Info By Tracking Number
from ups_turkey import UPSService
ups = UPSService('CUSTOMER_NUMBER', 'USERNAME', 'PASSWORD')
payload = {
'InformationLevel': 1,
'TrackingNumber': 'YOUR_TRACKING_NUMBER'
}
result = ups.GetShipmentInfoByTrackingNumber_V2(**payload)
You can convert to JSON if you like
import json
from decimal import Decimal
# This for encode decimal values
class DecimalEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, Decimal):
return float(obj)
return json.JSONEncoder.default(self, obj)
print(json.dumps(result, ensure_ascii=False, cls=DecimalEncoder))
Get Transactions By Tracking Number
from ups_turkey import UPSService
ups = UPSService('CUSTOMER_NUMBER', 'USERNAME', 'PASSWORD')
payload = {
'InformationLevel': 1,
'TrackingNumber': '1ZE3184E6800392064'
}
result = ups.GetTransactionsByTrackingNumber_V1(**payload)
Get Transactions By List
from ups_turkey import UPSService
ups = UPSService('CUSTOMER_NUMBER', 'USERNAME', 'PASSWORD')
payload = {
'SessionID': '',
'InformationLevel': 1,
'refList': {
'referansType': 'WAYBILL_TYPE',
'referansList': ['YOUR_UPSReferance_CODE']
},
'trnType': 'ALL_TRANSACTIONS'
}
result = ups.GetTransactionsByList_V2(**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.1.0.tar.gz
(7.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ups_turkey-0.1.0.tar.gz.
File metadata
- Download URL: ups_turkey-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc3fd490afd073f3a7d17aa6e9a99a0bd137fdad8ee100d48a2c5d8743e95ade
|
|
| MD5 |
40027e4f240df60452d82870b6183c38
|
|
| BLAKE2b-256 |
97ea1e89e1125401d3ba12fd5524bbbd642de903ad1fbbd45834a6f9cf54a17d
|
File details
Details for the file ups_turkey-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ups_turkey-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29b69510abb8d9c3b93121c03367c4e653779754b67c3e548899c9f537419723
|
|
| MD5 |
0bd6d29ab12ac265585be175c504c579
|
|
| BLAKE2b-256 |
774790b33eeac46e63d4448e1697c7610ab1ecffe9cb6bdd663110cd53524f60
|