File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 100100# attributes through the response attribute on the request object.
101101print 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.
104106ascii_label_data = ship .response .CompletedShipmentDetail .CompletedPackageDetails [0 ].Label .Parts [0 ].Image
105107# Convert the ASCII data to binary.
106108label_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"""
111111This 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' )
113115png_file .write (label_binary_data )
114116png_file .close ()
115117
You can’t perform that action at this time.
0 commit comments