Skip to main content

Api client for Pathao Courier API

Project description

Pathao-courier-api

API DOCS: Pathao Api

Python wrapper for Pathao courier api

Setup

pip install pathao-courier-api

Usage

from pathao_api import PathaoApi
client = PathaoApi(client_id = 267,
                   client_secret='wRcaibZkUdSNz2EI9ZyuXLlNrnAv0TdPUPXMnD39',
                   username='test@pathao.com',
                   password='lovePathao',
    base_url='https://hermes-api.p-stageenv.xyz')

Test Access Token

client.access_token
'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjVj...52PQWEl1lJF3goasTkbHsnXoLKEcicpRdo0'

Test city, zone, area list

client.get_city_list()
{'data': [{'city_id': 32, 'city_name': 'B. Baria'},
  {'city_id': 52, 'city_name': 'Bagerhat'},
  {'city_id': 62, 'city_name': 'Bandarban '},
  {'city_id': 34, 'city_name': 'Barguna '},
  {'city_id': 17, 'city_name': 'Barisal'},
  ...
  {'city_id': 61, 'city_name': 'Chuadanga'},
  {'city_id': 11, 'city_name': "Cox's Bazar"},
  {'city_id': 5, 'city_name': 'Cumilla'},
  {'city_id': 1, 'city_name': 'Dhaka'},
 ]}
client.get_zone_list(city_id=1)
{'data': [{'zone_id': 1016, 'zone_name': ' Dhamrai , Savar'},
  {'zone_id': 298, 'zone_name': '60 feet'},
  {'zone_id': 52, 'zone_name': 'Adabor'},
  {'zone_id': 300, 'zone_name': 'Aftab Nagar'},
  {'zone_id': 17, 'zone_name': 'Agargaon'},
  {'zone_id': 317, 'zone_name': 'Arambag'},
  {'zone_id': 965, 'zone_name': 'Ashkona'},
  ....
  {'zone_id': 940, 'zone_name': 'Uttara Sector 9'},
  {'zone_id': 938, 'zone_name': 'Uttara sector 6'},
  {'zone_id': 962, 'zone_name': 'Vatara'},
  {'zone_id': 37, 'zone_name': 'Wari'},
  {'zone_id': 352, 'zone_name': 'kafrul'},
  {'zone_id': 655, 'zone_name': 'kamranggirchar'},
  {'zone_id': 976, 'zone_name': 'shampur'}]}
client.get_area_list(zone_id=4)
{'data': [{'area_id': 47,
   'area_name': ' Road 02',
   'home_delivery_available': True,
   'pickup_available': True},
  {'area_id': 48,
   'area_name': ' Road 03',
   'home_delivery_available': True,
   'pickup_available': True},
  {'area_id': 49,
   'area_name': ' Road 04',
   'home_delivery_available': True,
   'pickup_available': True},
  ...
  {'area_id': 83,
   'area_name': 'Road 119',
   'home_delivery_available': True,
   'pickup_available': True},
  {'area_id': 16440,
   'area_name': 'Spectra covention centre',
   'home_delivery_available': True,
   'pickup_available': True},
  {'area_id': 16444,
   'area_name': 'The Glass house',
   'home_delivery_available': True,
   'pickup_available': True},
  {'area_id': 16443,
   'area_name': 'Zaara convention centre',
   'home_delivery_available': True,
   'pickup_available': True}]}

Test get stores

client.get_stores()
{'message': 'Store list fetched.',
 'type': 'success',
 'code': 200,
 'data': {'data': [{'store_id': 55876,
    'store_name': 'Uttara Hub',
    'store_address': '53 , Nawabpur Dhaka -1100',
    'is_active': 1,
    'city_id': 1,
    'zone_id': 259,
    'hub_id': 5,
    'is_default_store': False,
    'is_default_return_store': False},
   ...
   {'store_id': 11026,
    'store_name': 'Logistic Company E-desh',
    'store_address': '12 Gausul Azam Avinue, Uttara-13, Dhaka,Bangladesh',
    'is_active': 1,
    'city_id': 1,
    'zone_id': 1,
    'hub_id': 1,
    'is_default_store': False,
    'is_default_return_store': False}],
  'total': 171,
  'current_page': 1,
  'per_page': 1000,
  'total_in_page': 171,
  'last_page': 1,
  'path': 'http://hermes-api.p-stageenv.xyz/aladdin/api/v1/stores',
  'to': 171,
  'from': 1,
  'last_page_url': 'http://hermes-api.p-stageenv.xyz/aladdin/api/v1/stores?page=1',
  'first_page_url': 'http://hermes-api.p-stageenv.xyz/aladdin/api/v1/stores?page=1'}}

Test delivery cost calculator

client.get_delivery_cost(city_id=1, zone_id=4, delivery_type=48, item_type='2', store_id='55876')
{'price': 60,
 'discount': 0,
 'promo_discount': 0,
 'plan_id': 39,
 'cod_enabled': 0,
 'cod_percentage': 0,
 'additional_charge': 0}

Test Create Order

client.create_order(store_id='55876', 
                    order_id='Test #1', 
                    sender_name='Sender Name',
                    sender_phone='01717171717', 
                    recipient_name='Customer', 
                    recipient_phone='01717171718', 
                    address='Gulshan Avenue, Road 105',
                    city_id='1',
                    zone_id='4',
                    area_id='105',
                    special_instruction='None',
                    item_quantity='1',
                    item_weight=1,
                    amount_to_collect=1000,
                    item_description='None',
                    delivery_type=48,
                    item_type='2')
    {'consignment_id': 'DZ010523G674QD',
     'merchant_order_id': 'Test #1',
     'order_status': 'Pending',
     'delivery_fee': 70}

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

pathao-courier-api-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

pathao_courier_api-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pathao-courier-api-1.0.0.tar.gz.

File metadata

  • Download URL: pathao-courier-api-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pathao-courier-api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8dceaacb336e61b789304b0eba563ee7de65230243f8b2b528ca6e064d98cc5c
MD5 14c4f06eddb3a6d695f9393d83520b58
BLAKE2b-256 3e0ad4c2a7ecbabd95cb318d19f54d51359e531df7c2184955b8a3eee2c9a2a2

See more details on using hashes here.

File details

Details for the file pathao_courier_api-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pathao_courier_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed76a9b3564828eda6fc697d5b12eb47ee17414022487318d24d3a5f2b8db418
MD5 67899a37fd67eda732801faf800de0f6
BLAKE2b-256 8b414dbf5aef6b6f59661013f49fd2eb7105e96e997167fcaad4de1543a33202

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