Skip to content

Commit 29093ae

Browse files
author
chriskh
committed
other updates
1 parent cccb37e commit 29093ae

File tree

8 files changed

+218
-16
lines changed

8 files changed

+218
-16
lines changed

labs/tutorials/data-kiosk/data-kiosk-flow.ipynb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,17 @@
289289
"\n",
290290
"Make sure you’ve run the cell above so `get_document_response` is available.\n",
291291
"\n",
292-
"🚨 Update this code to plot the metrics that make sense based on the query you submitted\n"
292+
"🚨 Update this code to plot the metrics that make sense based on the query you submitted"
293293
]
294294
},
295+
{
296+
"metadata": {},
297+
"cell_type": "code",
298+
"outputs": [],
299+
"execution_count": null,
300+
"source": "pip install pandas",
301+
"id": "6eb9f3ee0e837b80"
302+
},
295303
{
296304
"cell_type": "code",
297305
"execution_count": null,

labs/workshops/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The fastest way to get started is using our automated setup scripts:
1919

2020
**macOS/Linux:**
2121
```bash
22-
cd sellig-partner-api-samples/labs/server
22+
cd selling-partner-api-samples/labs/server
2323
sh setup.sh
2424
```
2525

labs/workshops/listings-wizard/00-low-conversion-challenge.ipynb

Lines changed: 124 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,36 @@
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": null,
3231
"id": "ef145f6d-ce8c-4c21-804e-254ca8190350",
33-
"metadata": {},
34-
"outputs": [],
32+
"metadata": {
33+
"ExecuteTime": {
34+
"end_time": "2025-09-29T12:14:48.174450Z",
35+
"start_time": "2025-09-29T12:14:46.832477Z"
36+
}
37+
},
3538
"source": [
3639
"pip install amzn-sp-api==1.2.0"
37-
]
40+
],
41+
"outputs": [
42+
{
43+
"name": "stdout",
44+
"output_type": "stream",
45+
"text": [
46+
"Requirement already satisfied: amzn-sp-api==1.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (1.2.0)\r\n",
47+
"Requirement already satisfied: urllib3<3.0.0,>=2.1.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from amzn-sp-api==1.2.0) (2.3.0)\r\n",
48+
"Requirement already satisfied: certifi>=2025.1.31 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from amzn-sp-api==1.2.0) (2025.8.3)\r\n",
49+
"Requirement already satisfied: requests>=2.32.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from amzn-sp-api==1.2.0) (2.32.3)\r\n",
50+
"Requirement already satisfied: six>=1.17.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from amzn-sp-api==1.2.0) (1.17.0)\r\n",
51+
"Requirement already satisfied: charset-normalizer<4,>=2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests>=2.32.3->amzn-sp-api==1.2.0) (3.4.1)\r\n",
52+
"Requirement already satisfied: idna<4,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests>=2.32.3->amzn-sp-api==1.2.0) (3.10)\r\n",
53+
"\r\n",
54+
"\u001B[1m[\u001B[0m\u001B[34;49mnotice\u001B[0m\u001B[1;39;49m]\u001B[0m\u001B[39;49m A new release of pip is available: \u001B[0m\u001B[31;49m23.2.1\u001B[0m\u001B[39;49m -> \u001B[0m\u001B[32;49m25.2\u001B[0m\r\n",
55+
"\u001B[1m[\u001B[0m\u001B[34;49mnotice\u001B[0m\u001B[1;39;49m]\u001B[0m\u001B[39;49m To update, run: \u001B[0m\u001B[32;49m/usr/local/bin/python3 -m pip install --upgrade pip\u001B[0m\r\n",
56+
"Note: you may need to restart the kernel to use updated packages.\n"
57+
]
58+
}
59+
],
60+
"execution_count": 1
3861
},
3962
{
4063
"cell_type": "markdown",
@@ -59,10 +82,13 @@
5982
},
6083
{
6184
"cell_type": "code",
62-
"execution_count": null,
6385
"id": "4b7d9770-ccdc-4edd-a910-242916c578f7",
64-
"metadata": {},
65-
"outputs": [],
86+
"metadata": {
87+
"ExecuteTime": {
88+
"end_time": "2025-09-29T12:15:13.908703Z",
89+
"start_time": "2025-09-29T12:15:13.887970Z"
90+
}
91+
},
6692
"source": [
6793
"from spapi.models.datakiosk_v2023_11_15 import GetDocumentResponse, CreateQueryResponse, GetQueriesResponse, Query\n",
6894
"from spapi import SPAPIConfig, SPAPIClient, ApiException, QueriesApi, ListingsApi\n",
@@ -85,7 +111,17 @@
85111
"data_kiosk_api = QueriesApi(client.api_client)\n",
86112
"listings_api = ListingsApi(client.api_client)\n",
87113
"print(\"💻 API Client initiated\")"
88-
]
114+
],
115+
"outputs": [
116+
{
117+
"name": "stdout",
118+
"output_type": "stream",
119+
"text": [
120+
"💻 API Client initiated\n"
121+
]
122+
}
123+
],
124+
"execution_count": 5
89125
},
90126
{
91127
"cell_type": "markdown",
@@ -118,15 +154,26 @@
118154
"- Check their status\n",
119155
"- Download results\n",
120156
" \n",
121-
"🙌 Time to get seller data with the power of GraphQL!\n"
157+
"🙌 Time to get seller data with the power of GraphQL!"
122158
]
123159
},
124160
{
161+
"metadata": {},
125162
"cell_type": "code",
163+
"outputs": [],
126164
"execution_count": null,
165+
"source": "pip install pandas",
166+
"id": "6cc8eb127ee0292b"
167+
},
168+
{
169+
"cell_type": "code",
127170
"id": "7250c7cd-62cd-4ce3-9c40-db746184a37f",
128-
"metadata": {},
129-
"outputs": [],
171+
"metadata": {
172+
"ExecuteTime": {
173+
"end_time": "2025-09-29T12:15:50.137187Z",
174+
"start_time": "2025-09-29T12:15:49.991204Z"
175+
}
176+
},
130177
"source": [
131178
"graphql_query_str = (\"query { analytics_economics_2024_03_15 { economics( marketplaceIds: [\\\"ATVPDKIKX0DER\\\"], \"\n",
132179
" \"startDate: \\\"2025-06-01\\\", endDate: \\\"2025-06-05\\\", \"\n",
@@ -192,7 +239,62 @@
192239
"\n",
193240
"plt.tight_layout()\n",
194241
"plt.show()\n"
195-
]
242+
],
243+
"outputs": [
244+
{
245+
"name": "stdout",
246+
"output_type": "stream",
247+
"text": [
248+
"📃 Query: \n",
249+
" query { analytics_economics_2024_03_15 { economics( marketplaceIds: [\"ATVPDKIKX0DER\"], startDate: \"2025-06-01\", endDate: \"2025-06-05\", aggregateBy: { date: DAY, productId: MSKU } ) { startDate endDate msku marketplaceId sales { unitsOrdered netUnitsSold netProductSales { amount currencyCode } } netProceeds { total { amount currencyCode } } } } }\n",
250+
"✅ Query submitted! Response: {'query_id': '1000001'}\n",
251+
"⏱️ Query status: {'created_time': datetime.datetime(2025, 7, 17, 11, 25, 13, 645000, tzinfo=tzutc()),\n",
252+
" 'data_document_id': 'usecase_1_document_id.amzn.100001',\n",
253+
" 'error_document_id': None,\n",
254+
" 'pagination': None,\n",
255+
" 'processing_end_time': datetime.datetime(2025, 7, 17, 11, 25, 13, 645000, tzinfo=tzutc()),\n",
256+
" 'processing_start_time': datetime.datetime(2025, 7, 17, 11, 25, 13, 645000, tzinfo=tzutc()),\n",
257+
" 'processing_status': 'DONE',\n",
258+
" 'query': 'query { analytics_economics_2024_03_15 { economics( marketplaceIds: '\n",
259+
" '[\"ATVPDKIKX0DER\"], startDate: \"2025-06-01\", endDate: \"2025-06-05\", '\n",
260+
" 'aggregateBy: { date: DAY, productId: MSKU } ) { startDate endDate '\n",
261+
" 'msku marketplaceId sales { unitsOrdered netUnitsSold '\n",
262+
" 'netProductSales { amount currencyCode } } netProceeds { total { '\n",
263+
" 'amount currencyCode } } } } }',\n",
264+
" 'query_id': '1000001'}\n",
265+
"📊 Here's your data: {'document_id': 'usecase_1_document_id.amzn.100001',\n",
266+
" 'document_url': \"{'data': {'analytics_economics_2024_03_15': {'economics': \"\n",
267+
" \"[{'startDate': '2025-06-01', 'endDate': '2025-06-01', \"\n",
268+
" \"'msku': 'MOTOR-GEAR-US', 'marketplaceId': 'ATVPDKIKX0DER', \"\n",
269+
" \"'sales': {'unitsOrdered': 0, 'netUnitsSold': 0, \"\n",
270+
" \"'netProductSales': {'amount': 0.0, 'currencyCode': 'USD'}}, \"\n",
271+
" \"'netProceeds': {'total': {'amount': 0.0, 'currencyCode': \"\n",
272+
" \"'USD'}}}, {'startDate': '2025-06-01', 'endDate': \"\n",
273+
" \"'2025-06-01', 'msku': 'MOTOR-GEAR-CA', 'marketplaceId': \"\n",
274+
" \"'A2EUQ1WTGCTBG2', 'sales': {'unitsOrdered': 50, \"\n",
275+
" \"'netUnitsSold': 50, 'netProductSales': {'amount': 1000.0, \"\n",
276+
" \"'currencyCode': 'CAD'}}, 'netProceeds': {'total': {'amount': \"\n",
277+
" \"800.0, 'currencyCode': 'CAD'}}}, {'startDate': '2025-06-01', \"\n",
278+
" \"'endDate': '2025-06-01', 'msku': 'MOTOR-GEAR-MX', \"\n",
279+
" \"'marketplaceId': 'A1AM78C64UM0Y8', 'sales': {'unitsOrdered': \"\n",
280+
" \"50, 'netUnitsSold': 50, 'netProductSales': {'amount': \"\n",
281+
" \"1000.0, 'currencyCode': 'Mex'}}, 'netProceeds': {'total': \"\n",
282+
" \"{'amount': 800.0, 'currencyCode': 'Mex'}}}]}}}\"}\n"
283+
]
284+
},
285+
{
286+
"ename": "ModuleNotFoundError",
287+
"evalue": "No module named 'pandas'",
288+
"output_type": "error",
289+
"traceback": [
290+
"\u001B[31m---------------------------------------------------------------------------\u001B[39m",
291+
"\u001B[31mModuleNotFoundError\u001B[39m Traceback (most recent call last)",
292+
"\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[6]\u001B[39m\u001B[32m, line 22\u001B[39m\n\u001B[32m 19\u001B[39m \u001B[38;5;28mprint\u001B[39m(\u001B[33m\"\u001B[39m\u001B[33m📊 Here\u001B[39m\u001B[33m'\u001B[39m\u001B[33ms your data:\u001B[39m\u001B[33m\"\u001B[39m, get_document)\n\u001B[32m 21\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mast\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m22\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mpandas\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;28;01mas\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mpd\u001B[39;00m\n\u001B[32m 23\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mmatplotlib\u001B[39;00m\u001B[34;01m.\u001B[39;00m\u001B[34;01mpyplot\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[38;5;28;01mas\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mplt\u001B[39;00m\n\u001B[32m 25\u001B[39m \u001B[38;5;66;03m# Safely convert the string to a dictionary\u001B[39;00m\n",
293+
"\u001B[31mModuleNotFoundError\u001B[39m: No module named 'pandas'"
294+
]
295+
}
296+
],
297+
"execution_count": 6
196298
},
197299
{
198300
"cell_type": "markdown",
@@ -377,13 +479,21 @@
377479
"patch_listing = listings_api.patch_listings_item('AMY7FKRUBY7XV', 'MOTOR-GEAR-US',['ATVPDKIKX0DER'], body)\n",
378480
"print(\"💾 Submission result: \\n\", json.dumps(patch_listing.to_dict(), indent=4, default=str))"
379481
]
482+
},
483+
{
484+
"metadata": {},
485+
"cell_type": "code",
486+
"outputs": [],
487+
"execution_count": null,
488+
"source": "",
489+
"id": "207ce43df479a203"
380490
}
381491
],
382492
"metadata": {
383493
"kernelspec": {
384-
"display_name": "conda_python3",
494+
"display_name": "Python 3 (ipykernel)",
385495
"language": "python",
386-
"name": "conda_python3"
496+
"name": "python3"
387497
},
388498
"language_info": {
389499
"codemirror_mode": {

labs/workshops/listings-wizard/02-high-refund-challenge.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@
124124
"\n"
125125
]
126126
},
127+
{
128+
"metadata": {},
129+
"cell_type": "code",
130+
"outputs": [],
131+
"execution_count": null,
132+
"source": "pip install pandas",
133+
"id": "126758787e6eddb2"
134+
},
127135
{
128136
"cell_type": "code",
129137
"execution_count": null,

labs/workshops/listings-wizard/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ You can run these notebooks on **Amazon SageMaker → Notebook Instances**
4444
```bash
4545
git clone https://github.com/amzn/sp-api-sample-solutions.git
4646
cd labs/workshops/listings-wizard
47+
python3 -m venv venv
48+
source venv/bin/activate
49+
pip install -r requirements.txt
4750
jupyter lab
4851
```
4952
---
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pandas
2+
matplotlib
3+
jupyter
4+
httpx
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 🚚 ShippingGuru SP-API Workshop
2+
3+
Welcome to the **ShippingGuru Challenge**!
4+
In this hands-on workshop, you’ll take on the role of a **Shipping Specialist** helping our (fictional) company **ShippingGuru** debug and optimize their sellers’ fulfillment flows.
5+
6+
You’ll solve **real-world shipping and order management scenarios** using SP-API, Jupyter Notebooks, and the official SP-API SDK.
7+
8+
---
9+
10+
## 🚀 How to Access
11+
12+
### Quick Start - Amazon SP-API Mock Server
13+
14+
The fastest way to get started is using our automated setup scripts:
15+
16+
**macOS/Linux:**
17+
```bash
18+
cd selling-partner-api-samples/labs/server
19+
sh setup.sh
20+
```
21+
Or download and run:
22+
23+
```bash
24+
curl -O https://raw.githubusercontent.com/amzn/sp-api-sample-solutions/main/labs/server/setup.sh
25+
chmod +x setup.sh
26+
./setup.sh
27+
```
28+
29+
**Windows:**
30+
31+
```bash
32+
setup.bat
33+
```
34+
35+
**The script will automatically:**
36+
37+
- Set up a virtual environment
38+
- Install all dependencies
39+
- Start the server at http://localhost:8000
40+
41+
You can run these notebooks on Amazon SageMaker → Notebook Instances
42+
**OR** run them locally in any Jupyter environment:
43+
44+
```bash
45+
git clone https://github.com/amzn/sp-api-sample-solutions.git
46+
cd labs/workshops/shipping-guru/buy-shipping-challenge
47+
python3 -m venv venv
48+
source venv/bin/activate
49+
pip install -r requirements.txt
50+
jupyter lab
51+
```
52+
53+
### 🧩 The Challenge
54+
55+
You’ll work through a single Buy Shipping scenario:
56+
57+
**00-buy-shipping-challenge.ipynb**
58+
59+
- Problem: A seller is having issues purchasing and validating shipping labels through SP-API.
60+
- Your task: Debug the order and shipment flow using the Orders and Shipping APIs.
61+
- Clues: check order ID validity, item identifiers, addresses, rate IDs, and label format.
62+
- Deliverable: identify the errors in the workflow and successfully purchase a valid shipping label.
63+
64+
### 🛠️ Tools You’ll Use
65+
66+
- SP-API SDK → pre-installed in the environment (Python).
67+
- Sample Payloads → included in the notebook.
68+
- Mock Endpoints → provided for safe submission. If you have your own Mock Endpoints developed feel free to use them in the variables listed instead.
69+
- Clues & Hints → embedded in the notebook to guide you.

labs/workshops/shipping-guru/requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)