Created
June 26, 2013 15:13
-
-
Save sharoonthomas/5868273 to your computer and use it in GitHub Desktop.
PyUPS setting the transaction refernce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ups import ShipmentConfirm | |
from lxml.builder import E | |
shipment_confirm_api = ShipmentConfirm('a', 'b', 'c', 'd') | |
# Print the value of the TransactionReference | |
print etree.tostring(shipment_confirm_api.TransactionReference, pretty_print=True) | |
""" | |
Output: | |
<TransactionReference> | |
<CustomerContext>unspecified</CustomerContext> | |
</TransactionReference> | |
""" | |
# Set a value for transaction reference | |
shipment_confirm_api.TransactionReference = E.TransactionReference( | |
E.CustomerContext('1234') | |
) | |
# Print the value of the TransactionReference again | |
print etree.tostring(shipment_confirm_api.TransactionReference, pretty_print=True) | |
""" | |
Output: | |
<TransactionReference> | |
<CustomerContext>1234</CustomerContext> | |
</TransactionReference> | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment