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 raiseUPSException(ERROR_CODE, ERROR_DEFINATION)passraise_exception=Trueparam likeresult.is_success(raise_exception=True) result.get_error()for getting result's error code and defination as tuple if has
- Convert result to JSON:
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 raiseUPSException(ERROR_CODE, ERROR_DEFINATION)passraise_exception=Trueparam likeresult.has_fail(raise_exception=True)
- Convert result to JSON:
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
- GetLastTransactionByTrackingNumber_V1
- GetPackageInfoByDatePeriod_V1
- GetPackageInfoByReferance_V1
- GetPackageInfoByTrackingNumber_V1
- GetShipmentInfoByTrackingNumber_V1
- GetShipmentInfoByTrackingNumber_V2
- GetTiNTInformationByTrackingNumberList_V1
- GetTiNTInformationByTrackingNumber_V1
- GetTransactionsByCustomerCode_V1
- GetTransactionsByList_V1
- GetTransactionsByList_V2
- GetTransactionsByPackagePickupDate_V1
- GetTransactionsByTrackingNumber_V1
- GetUnreadTransactionsByTrackingNumber_V1
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)
Metadata
Release files for ups-turkey 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ups_turkey-0.2.0.tar.gz | 8.5 kB | Without provenance | Details for ups_turkey-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ups_turkey-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for ups_turkey-0.2.0-py3-none-any.whl |
Total release size: 15.3 kB
Release files / ups_turkey-0.2.0.tar.gz
| Download URL | ups_turkey-0.2.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d49fbac7b7a6310002d206f3a642836de1665be14cc665a9382418d8743b5dd
|
|
BLAKE2b-256 checksum How to use checksums |
ac5350b571fc04c55f6a302c91283408ad2f94d4da4747642c57c9bb6ec7de31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / ups_turkey-0.2.0-py3-none-any.whl
| Download URL | ups_turkey-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec96a3b74ce7239eac48659375af44c38d9c4ee873c8f88951abd977d44d89c4
|
|
BLAKE2b-256 checksum How to use checksums |
b35b43694c188301a235e0e625ad034f0199939e97dd48f487df2bdd8aa9ed17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Security for ups-turkey 0.2.0
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.