Compare commits

..

No commits in common. "79240557a1f71043405c5707022e0bf9876491fb" and "d20c1f56722e0111e79ccd1325f258f7b26b2762" have entirely different histories.

7 changed files with 9 additions and 25 deletions

2
.gitignore vendored
View file

@ -1,7 +1,5 @@
# Sensitive files # Sensitive files
config.py config.py
*.json
*.JSON
# ---> Python # ---> Python
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files

View file

View file

@ -1,8 +0,0 @@
{
"default_delivery_name" : "Lisa Doe",
"default_delivery_number" : "87654321",
"default_delivery_email" : "",
"default_delivery_address" : "2 Orchard Turn, Singapore 238801",
"default_delivery_pincode" : "238801",
"default_delivery_remark" : ""
}

View file

@ -12,10 +12,7 @@ These Python scripts allow to place, track and delete delivery requests using th
* Copy the file `config-sample.py` to `config.py`. * Copy the file `config-sample.py` to `config.py`.
* Edit `config.py` with your credentials and defaults. * Edit `config.py` with your credentials and defaults.
* Inside the folder `JSON files` copy the `default_address.json.sample` to `default_address.json`. * To place a delivery request, run `python3 req_delivery.py` and follow the instructions of the script.
* Edit `default_address.json` with your defaults for the delivery address.
* Using `default_address.json` as a template, you may create personalised `.json` files for your frequent delivery addresses.
* To place a delivery request, run `python3 req_delivery.py <address.json>` and follow the instructions of the script. If you leave the parameter `<address.json>` blank, the script will use the data from `default_address.json`.
* To track the status of a delivery request, run `python3 track.py <track_id>`, where `<track_id>` is the uParcel trucking code of your delivery. * To track the status of a delivery request, run `python3 track.py <track_id>`, where `<track_id>` is the uParcel trucking code of your delivery.
* To cancel a delivery request, run `python3 cancel_delivery.py <order_id>`, where `<order_id>` is the Order ID you provided when you made the request *(note that this is NOT the `<track_id>`)*. * To cancel a delivery request, run `python3 cancel_delivery.py <order_id>`, where `<order_id>` is the Order ID you provided when you made the request *(note that this is NOT the `<track_id>`)*.

View file

View file

@ -22,4 +22,10 @@ default_pickup_address = "1 Scotts Road, Singapore 228208"
default_pickup_pincode = "228208" default_pickup_pincode = "228208"
default_pickup_remark = "" default_pickup_remark = ""
default_vehicle = "all" default_vehicle = "all"
default_delivery_name = "Lisa Doe"
default_delivery_number = "87654321"
default_delivery_email = ""
default_delivery_address = "2 Orchard Turn, Singapore 238801"
default_delivery_pincode = "238801"
default_delivery_remark = ""

View file

@ -5,16 +5,7 @@ from push import *
import sys import sys
import base64 import base64
def req_delivery(address_file='default_address.json'): def req_delivery():
f = open("JSON files/"+address_file)
address = json.load(f)
f.close()
default_delivery_name = address['default_delivery_name']
default_delivery_number = address['default_delivery_number']
default_delivery_email = address['default_delivery_email']
default_delivery_address = address['default_delivery_address']
default_delivery_pincode = address['default_delivery_pincode']
default_delivery_remark = address['default_delivery_remark']
order_id = int(input('Enter the Order ID: ') or '1') order_id = int(input('Enter the Order ID: ') or '1')
url = base_url + "api/merchant/auth/" url = base_url + "api/merchant/auth/"
payload = json.dumps({ payload = json.dumps({
@ -132,5 +123,5 @@ def req_delivery(address_file='default_address.json'):
}))) })))
if __name__ == '__main__': if __name__ == '__main__':
req_delivery(sys.argv[1]) req_delivery()