Skip to content

Commit 38b2000

Browse files
author
Greg Taylor
committed
Nitpicking my example.
1 parent 6953a86 commit 38b2000

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/create_shipment.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,18 @@
100100
# attributes through the response attribute on the request object.
101101
print ship.response
102102

103-
# Get the label image in ASCII format from the reply.
103+
# Get the label image in ASCII format from the reply. Note the list indices
104+
# we're using. You'll need to adjust or iterate through these if your shipment
105+
# has multiple packages.
104106
ascii_label_data = ship.response.CompletedShipmentDetail.CompletedPackageDetails[0].Label.Parts[0].Image
105107
# Convert the ASCII data to binary.
106108
label_binary_data = binascii.a2b_base64(ascii_label_data)
107-
# This will be the file we write the label out to.
108-
png_file = open('example_shipment_label.png', 'wb')
109109

110110
"""
111111
This is an example of how to dump a label to a PNG file.
112112
"""
113+
# This will be the file we write the label out to.
114+
png_file = open('example_shipment_label.png', 'wb')
113115
png_file.write(label_binary_data)
114116
png_file.close()
115117

0 commit comments

Comments
 (0)