# Shipday Python SDK
The Shipday Python sdk provides easier access to Shipday API's
from Python applications and scripts.
## Documentation
See the [shipday api](https://docs.shipday.com) docs for Python.
## Requirements
Python 3.6 or higher
## Installation
```markdown
pip install shipday
```
## Usage
Import Shipday from shipday package.
```python
from shipday import Shipday
```
You need to provide the shipday api-key in order to use the library. To get your API key
login to your [Shipday Dispatch Dashboard](https://dispatch.shipday.com) and Find the
API key from integrations tab.
Example usages looks like following:-
```python
API_KEY = '##########.#######################'
my_shipday = Shipday(api_key=API_KEY)
```
This my_shipday object contains three services (CarrierService, OrderService and OnDemandDeliveryService) which you can use to get your job
done. Here are few examples,
### Carrier Service
To get all your carriers, use get_carriers() function of the CarrierService. Following example
prints the number of carriers you have -
```python
my_carriers = my_shipday.CarrierService.get_carriers()
print('I have {} carriers'.format(len(my_carriers)))
```
To add a carrier, you need to create a CarrierRequest and send it using add_carrier() function of
CarrierService.
See the example below -
```python
from shipday.carrier import CarrierRequest
carrier_req = CarrierRequest(name='John Doe',
email='john.doe@shipday.com',
phone_number='+123456789')
my_shipday.CarrierService.add_carrier(carrier_req)
```
To delete a carrier, use delete_carrier() function of the CarrierService. For example-
```python
my_shipday.CarrierService.delete_carrier(carrier_id=1234)
```
### Order Service
To get all the orders, use get_orders() function of the OrderService.
```python
my_orders = my_shipday.OrderService.get_orders()
```
To add an order, you need to create an Order object and send it using insert_order() function of
OrderService. For example -
```python
from shipday.order import Address, Customer, Pickup, OrderItem, Order
new_order = Order(orderNumber='100')
# Add customer details
new_order.customer = Customer(
name='John Doe', email='john.doe', phone_number='+12367124',
address=Address(street='556 Crestlake Dr', city='San Francisco', state='California', country='USA')
)
# Don't worry if you forget to send a parameter, you can also set it later like following line
new_order.customer.address.zip = 'CA 94132'
# Add pickup details
new_order.pickup = Pickup(
name='My pickup point', phone_number='+132462374'
)
new_order.pickup.address = Address(street='890 Geneva Av', city='San Fransisco', state='California', zip='CA 94132',
country='USA')
# Add order items
new_order.order_items = [OrderItem(name='Pizza', unit_price=10.0, quantity=1)]
new_order.order_items.append(
OrderItem(name='Popcorn Shrimp', quantity=1, unit_price=5)
)
my_shipday.OrderService.insert_order(new_order)
```
To retrieve orders by order number, use get_order function. This will return a list of orders matching the given
order_number.
```python
orders = my_shipday.OrderService.get_order(order_number='100')
```
To assign an order to a carrier, use assign_order() function. For example,
```python
my_shipday.OrderService.assign_order(order_id=7995257, carrier_id=242324)
```
To delete an order, use delete_order() function. For example,
```python
my_shipday.OrderService.delete_order(order_id=7995246)
```
You can also query orders using query() function. For that you need to create a OrderQuery object. Following
code retrieves all orders from last 24 hours -
```python
from shipday.order import OrderQuery
query = OrderQuery()
from datetime import datetime, timedelta
query.start_time = datetime.now() - timedelta(days=1)
my_shipday.OrderService.query(query=query)
```
### OnDemandDeliveryService
To get informations on On-Demand Delivery Services use get_services() function like following code -
```python
my_shipday.OnDemandDeliveryService.get_services()
```
You can use get_active_services() function to retrieve the service names of those available to your account.
```python
my_shipday.OnDemandDeliveryService.get_active_services()
```
To estimate the cost and required delivery time from available delivery services, use estimate() function -
```python
my_shipday.OnDemandDeliveryService.estimate(order_id=123424)
```
You can assign an order to a delivery service provider by calling assign() method. For example,
```python
my_shipday.OnDemandDeliveryService.assign(order_id=1234, service_name='Uber')
```
After assigning an order to a service, you can get the details using get_details() method.
```python
my_shipday.OnDemandDeliveryService.get_details(order_id=1234)
```
If something goes wrong, you can cancel an assigned order using cancel() function. But this is not guaranteed to work-.
```python
my_shipday.OnDemandDeliveryService.cancel(order_id=1234)
```
Raw data
{
"_id": null,
"home_page": "https://shipday.com/",
"name": "shipday",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "Shipday,DoorDash,Uber,Delivery API,Dispatch API,DoorDash API,Uber API,Dispatch App,Courier App,Delivery Dispatch,Delivery integration,Delivery Management,Dispatch Management,Delivery Service Integration,Local Delivery API",
"author": "Shipday",
"author_email": "shahriar@shipday.com",
"download_url": "https://files.pythonhosted.org/packages/07/a3/06eaa0f4cdd0377dfaa4b6f09825f9bdb0d75c6ecc9eb35d674d94002d3d/shipday-1.3.0.tar.gz",
"platform": null,
"description": "# Shipday Python SDK\n\nThe Shipday Python sdk provides easier access to Shipday API's\nfrom Python applications and scripts.\n\n## Documentation\n\nSee the [shipday api](https://docs.shipday.com) docs for Python.\n\n## Requirements\n\nPython 3.6 or higher\n\n## Installation\n\n```markdown\npip install shipday\n```\n\n## Usage\n\nImport Shipday from shipday package.\n\n```python\nfrom shipday import Shipday\n```\n\nYou need to provide the shipday api-key in order to use the library. To get your API key\nlogin to your [Shipday Dispatch Dashboard](https://dispatch.shipday.com) and Find the \nAPI key from integrations tab.\n\nExample usages looks like following:-\n\n```python\nAPI_KEY = '##########.#######################'\nmy_shipday = Shipday(api_key=API_KEY)\n```\n\nThis my_shipday object contains three services (CarrierService, OrderService and OnDemandDeliveryService) which you can use to get your job\ndone. Here are few examples,\n\n### Carrier Service\n\nTo get all your carriers, use get_carriers() function of the CarrierService. Following example\nprints the number of carriers you have -\n\n```python\nmy_carriers = my_shipday.CarrierService.get_carriers()\nprint('I have {} carriers'.format(len(my_carriers)))\n```\n\nTo add a carrier, you need to create a CarrierRequest and send it using add_carrier() function of\nCarrierService.\nSee the example below -\n\n```python\nfrom shipday.carrier import CarrierRequest\n\ncarrier_req = CarrierRequest(name='John Doe',\n email='john.doe@shipday.com',\n phone_number='+123456789')\nmy_shipday.CarrierService.add_carrier(carrier_req)\n```\n\nTo delete a carrier, use delete_carrier() function of the CarrierService. For example-\n\n```python\nmy_shipday.CarrierService.delete_carrier(carrier_id=1234)\n```\n\n### Order Service\n\nTo get all the orders, use get_orders() function of the OrderService.\n\n```python\nmy_orders = my_shipday.OrderService.get_orders()\n```\n\nTo add an order, you need to create an Order object and send it using insert_order() function of\nOrderService. For example -\n\n```python\nfrom shipday.order import Address, Customer, Pickup, OrderItem, Order\n\nnew_order = Order(orderNumber='100')\n\n# Add customer details\nnew_order.customer = Customer(\n name='John Doe', email='john.doe', phone_number='+12367124',\n address=Address(street='556 Crestlake Dr', city='San Francisco', state='California', country='USA')\n)\n# Don't worry if you forget to send a parameter, you can also set it later like following line\nnew_order.customer.address.zip = 'CA 94132'\n\n# Add pickup details\nnew_order.pickup = Pickup(\n name='My pickup point', phone_number='+132462374'\n)\nnew_order.pickup.address = Address(street='890 Geneva Av', city='San Fransisco', state='California', zip='CA 94132',\n country='USA')\n\n# Add order items\nnew_order.order_items = [OrderItem(name='Pizza', unit_price=10.0, quantity=1)]\nnew_order.order_items.append(\n OrderItem(name='Popcorn Shrimp', quantity=1, unit_price=5)\n)\n\nmy_shipday.OrderService.insert_order(new_order)\n```\n\nTo retrieve orders by order number, use get_order function. This will return a list of orders matching the given\norder_number.\n\n```python\norders = my_shipday.OrderService.get_order(order_number='100')\n```\n\nTo assign an order to a carrier, use assign_order() function. For example,\n\n```python\nmy_shipday.OrderService.assign_order(order_id=7995257, carrier_id=242324)\n```\n\nTo delete an order, use delete_order() function. For example,\n\n```python\nmy_shipday.OrderService.delete_order(order_id=7995246)\n```\n\nYou can also query orders using query() function. For that you need to create a OrderQuery object. Following\ncode retrieves all orders from last 24 hours -\n\n```python\nfrom shipday.order import OrderQuery\n\nquery = OrderQuery()\n\nfrom datetime import datetime, timedelta\n\nquery.start_time = datetime.now() - timedelta(days=1)\n\nmy_shipday.OrderService.query(query=query)\n```\n\n### OnDemandDeliveryService\nTo get informations on On-Demand Delivery Services use get_services() function like following code -\n```python\nmy_shipday.OnDemandDeliveryService.get_services()\n```\n\nYou can use get_active_services() function to retrieve the service names of those available to your account.\n```python\nmy_shipday.OnDemandDeliveryService.get_active_services()\n```\n\nTo estimate the cost and required delivery time from available delivery services, use estimate() function -\n```python\nmy_shipday.OnDemandDeliveryService.estimate(order_id=123424)\n```\n\nYou can assign an order to a delivery service provider by calling assign() method. For example,\n```python\nmy_shipday.OnDemandDeliveryService.assign(order_id=1234, service_name='Uber')\n```\n\nAfter assigning an order to a service, you can get the details using get_details() method.\n```python\nmy_shipday.OnDemandDeliveryService.get_details(order_id=1234)\n```\n\nIf something goes wrong, you can cancel an assigned order using cancel() function. But this is not guaranteed to work-.\n```python\nmy_shipday.OnDemandDeliveryService.cancel(order_id=1234)\n```\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python library for Shipday API",
"version": "1.3.0",
"split_keywords": [
"shipday",
"doordash",
"uber",
"delivery api",
"dispatch api",
"doordash api",
"uber api",
"dispatch app",
"courier app",
"delivery dispatch",
"delivery integration",
"delivery management",
"dispatch management",
"delivery service integration",
"local delivery api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "753e26a8c1f3fa9d952f59aaa45987cac88466c1cc88f9f381ebe70979d0bcc4",
"md5": "1bde536ff474eab35cebe0cb49d2e5f2",
"sha256": "b4e430a2c5ef06609cbe2cf1802e29243b3072c824e927ce706d3623807f213a"
},
"downloads": -1,
"filename": "shipday-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1bde536ff474eab35cebe0cb49d2e5f2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17150,
"upload_time": "2023-04-17T15:29:39",
"upload_time_iso_8601": "2023-04-17T15:29:39.272130Z",
"url": "https://files.pythonhosted.org/packages/75/3e/26a8c1f3fa9d952f59aaa45987cac88466c1cc88f9f381ebe70979d0bcc4/shipday-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "07a306eaa0f4cdd0377dfaa4b6f09825f9bdb0d75c6ecc9eb35d674d94002d3d",
"md5": "4316492fea4f18795930016b44840567",
"sha256": "a0859c1ae48f4bdcba212e50d411aeacb93c87e469552d9c8c3f8759a1d9ee2d"
},
"downloads": -1,
"filename": "shipday-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "4316492fea4f18795930016b44840567",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13232,
"upload_time": "2023-04-17T15:29:40",
"upload_time_iso_8601": "2023-04-17T15:29:40.612351Z",
"url": "https://files.pythonhosted.org/packages/07/a3/06eaa0f4cdd0377dfaa4b6f09825f9bdb0d75c6ecc9eb35d674d94002d3d/shipday-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-17 15:29:40",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "shipday"
}