Skip to content

Commit e6fcc74

Browse files
author
Greg Taylor
committed
More label certification stuff.
1 parent a4deb76 commit e6fcc74

File tree

2 files changed

+79
-1
lines changed

2 files changed

+79
-1
lines changed

label_certification/express.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env python
2+
"""
3+
This module prints three FedEx Express shipping labels for the label
4+
certification process. See your FedEx Label Developer Tool Kit documentation
5+
for more details.
6+
"""
7+
import logging
8+
from cert_config import CONFIG_OBJ, SHIPPER_CONTACT_INFO, SHIPPER_ADDRESS, LABEL_SPECIFICATION
9+
from cert_config import transfer_config_dict
10+
from cert_config import LabelPrinterClass
11+
from fedex.services.ship_service import FedexProcessShipmentRequest
12+
13+
logging.basicConfig(level=logging.INFO)
14+
15+
shipment = FedexProcessShipmentRequest(CONFIG_OBJ)
16+
shipment.RequestedShipment.DropoffType = 'REGULAR_PICKUP'
17+
shipment.RequestedShipment.ServiceType = 'PRIORITY_OVERNIGHT'
18+
shipment.RequestedShipment.PackagingType = 'YOUR_PACKAGING'
19+
shipment.RequestedShipment.PackageDetail = 'INDIVIDUAL_PACKAGES'
20+
21+
# Shipper contact info.
22+
transfer_config_dict(shipment.RequestedShipment.Shipper.Contact,
23+
SHIPPER_CONTACT_INFO)
24+
25+
# Shipper address.
26+
transfer_config_dict(shipment.RequestedShipment.Shipper.Address,
27+
SHIPPER_ADDRESS)
28+
29+
# Recipient contact info.
30+
shipment.RequestedShipment.Recipient.Contact.PersonName = 'Recipient Name'
31+
shipment.RequestedShipment.Recipient.Contact.CompanyName = 'Recipient Company'
32+
shipment.RequestedShipment.Recipient.Contact.PhoneNumber = '9012637906'
33+
34+
# Recipient address
35+
shipment.RequestedShipment.Recipient.Address.StreetLines = ['Address Line 1']
36+
shipment.RequestedShipment.Recipient.Address.City = 'Herndon'
37+
shipment.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'VA'
38+
shipment.RequestedShipment.Recipient.Address.PostalCode = '20171'
39+
shipment.RequestedShipment.Recipient.Address.CountryCode = 'US'
40+
41+
shipment.RequestedShipment.ShippingChargesPayment.PaymentType = 'SENDER'
42+
43+
# Label config.
44+
transfer_config_dict(shipment.RequestedShipment.LabelSpecification,
45+
LABEL_SPECIFICATION)
46+
47+
package1_weight = shipment.create_wsdl_object_of_type('Weight')
48+
package1_weight.Value = 1.0
49+
package1_weight.Units = "LB"
50+
package1 = shipment.create_wsdl_object_of_type('RequestedPackageLineItem')
51+
package1.Weight = package1_weight
52+
shipment.add_package(package1)
53+
54+
shipment.send_request()
55+
device = LabelPrinterClass(shipment)
56+
device.print_label()
57+
58+
shipment.RequestedShipment.Recipient.Address.StreetLines = ['456 Peach St']
59+
shipment.RequestedShipment.Recipient.Address.City = 'Atlanta'
60+
shipment.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'GA'
61+
shipment.RequestedShipment.Recipient.Address.PostalCode = '30303'
62+
shipment.RequestedShipment.Recipient.Address.CountryCode = 'US'
63+
64+
shipment.send_request()
65+
device = LabelPrinterClass(shipment)
66+
device.print_label()
67+
68+
shipment.RequestedShipment.Recipient.Address.StreetLines = ['987 Main St']
69+
shipment.RequestedShipment.Recipient.Address.City = 'Boston'
70+
shipment.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'MA'
71+
shipment.RequestedShipment.Recipient.Address.PostalCode = '02115'
72+
shipment.RequestedShipment.Recipient.Address.CountryCode = 'US'
73+
74+
shipment.send_request()
75+
device = LabelPrinterClass(shipment)
76+
device.print_label()

label_certification/ground.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python
22
"""
3-
This module prints a label used to certify International Priority shipments.
3+
This module prints three FedEx Ground shipping labels for the label
4+
certification process. See your FedEx Label Developer Tool Kit documentation
5+
for more details.
46
"""
57
import logging
68
from cert_config import CONFIG_OBJ, SHIPPER_CONTACT_INFO, SHIPPER_ADDRESS, LABEL_SPECIFICATION

0 commit comments

Comments
 (0)