Skip to content

Commit 88c0256

Browse files
author
Greg Taylor
committed
More commenting and a few changes to the default label printer variables in the create_shipment.py example.
1 parent 293ab52 commit 88c0256

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

examples/create_shipment.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,27 @@
6969
# This is needed to ensure an accurate rate quote with the response.
7070
shipment.RecipientAddress.Residential = True
7171

72+
# Who pays for the shipment?
7273
# RECIPIENT, SENDER or THIRD_PARTY
7374
shipment.ShippingChargesPayment.PaymentType = 'SENDER'
7475

75-
# These are example label values. You'll want to adjust these to fit your
76-
# usage case.
76+
# Specifies the label type to be returned.
77+
# LABEL_DATA_ONLY or COMMON2D
7778
shipment.LabelSpecification.LabelFormatType = 'COMMON2D'
79+
80+
# Specifies which format the label file will be sent to you in.
81+
# DPL, EPL2, PDF, PNG, ZPLII
7882
shipment.LabelSpecification.ImageType = 'PNG'
79-
shipment.LabelSpecification.LabelStockType = 'PAPER_7X4.75'
83+
84+
# To use doctab stocks, you must change ImageType above to one of the
85+
# label printer formats (ZPLII, EPL2, DPL).
86+
# See documentation for paper types, there quite a few.
87+
shipment.LabelSpecification.LabelStockType = 'PAPER_4X6'
88+
89+
# This indicates if the top or bottom of the label comes out of the
90+
# printer first.
91+
# BOTTOM_EDGE_OF_TEXT_FIRST or TOP_EDGE_OF_TEXT_FIRST
92+
shipment.LabelSpecification.LabelPrintingOrientation = 'BOTTOM_EDGE_OF_TEXT_FIRST'
8093

8194
package1_weight = shipment.create_wsdl_object_of_type('Weight')
8295
# Weight, in pounds.
@@ -85,8 +98,11 @@
8598

8699
package1 = shipment.create_wsdl_object_of_type('RequestedPackageLineItem')
87100
package1.Weight = package1_weight
101+
# Un-comment this to see the other variables you may set on a package.
88102
#print package1
89103

104+
# This adds the RequestedPackageLineItem WSDL object to the shipment. It
105+
# increments the package count and total weight of the shipment for you.
90106
shipment.add_package(package1)
91107

92108
# If you'd like to see some documentation on the ship service WSDL, un-comment
@@ -104,7 +120,7 @@
104120
# This will show the reply to your shipment being sent. You can access the
105121
# attributes through the response attribute on the request object. This is
106122
# good to un-comment to see the variables returned by the Fedex reply.
107-
#print shipment.response
123+
print shipment.response
108124

109125
# Here is the overall end result of the query.
110126
print "HighestSeverity:", shipment.response.HighestSeverity

0 commit comments

Comments
 (0)