This script reads an Excel file containing Cisco Sales Order Numbers, and it queries Cisco Commerce Workspace to retrieve information per order. The retrieved information is written back to the Excel File. The script can be run periodically to continually update the Excel file and track updates for the desired field.
The working example is the Promised Delivery Date
field, but the code can be easily extended to other fields. Additional example fields are present in the CCWOrderParser
class in ccwparser.py
For a full list of fields, check out the Check Order Status
CCW API example on the Developer Portal.
This application requires access to the CCW Order API
provided at https://apiconsole.cisco.com/ and the creation of an App
.
A detailed guide is included here, with summarized steps bellow:
App
of Application Type
"Service" and Grant Type
= "Client Credentials"
key
and secret
, which are required for authentication!Note: this process may change in the future, always refer to the latest documentation on the platform.
This script expects an Excel file input with a minimum of:
Sales Order Numbers
Output
will be written to (if KEEP_HISTORY
= True, this is not necessary)The names of the columns are specified in the config.py
file, and other columns can be included as necessary depending on the use case.
Sales Order
, Delivery Date
(output -> if KEEP_HISTORY
= True, this is not necessary)SKU
, Ship Set Number
git clone [repository name]
.env_sample
file to .env
. Rename config_sample.py
to config.py
..env
from the prerequisites sectionCLIENT_KEY="" CLIENT_SECRET=""
KEEP_HISTORY
feature if desired (config.py
). This feature appends new date-stamped versions of OUTPUT_COLUMN_NAME
before the INSERT_BEFORE_COLUMN
value (Ex: Column 'F'). Columns are shifted to the right, the previous INSERT_BEFORE_COLUMN
value becomes the most recent entry, effectively tracking progression of a column over time from left to right.KEEP_HISTORY = False INSERT_BEFORE_COLUMN = ''
config.py
. Add any other columns as necessary for the use caseEXCEL_FILE_NAME = "" EXCEL_SHEET_NAME = "" SALES_ORDER_NUMBER_COLUMN_NAME = "" OUTPUT_COLUMN_NAME = ""
# For Delivery Date Use Case SHIP_SET_COLUMN_NAME = "" SKU_COLUMN_NAME = ""
pip3 install -r requirements.txt
Run the script with python ccwquery.py
The script will parse the input file, and using the Sales Order Number, retrieve order information from CCW.
This order information is parsed using the CCWOrderParser
, and can then be further processed for the specific use case. The results are written back to the Excel file's "output" column.
Optional: A cronjob can be created to periodically run ccwquery.py
. Please consult crontab.txt
for more information.
Provided under Cisco Sample Code License, for details see LICENSE
Our code of conduct is available here
See our contributing guidelines here
Please note: This script is meant for demo purposes only. All tools/ scripts in this repo are released for use "AS IS" without any warranties of any kind, including, but not limited to their installation, use, or performance. Any use of these scripts and tools is at your own risk. There is no guarantee that they have been through thorough testing in a comparable environment and we are not responsible for any damage or data loss incurred with their use.
You are responsible for reviewing and testing any scripts you run thoroughly before use in any non-testing environment.
Owner
Contributors
Categories
Programming Languages
PythonLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community