<s> from time import sleep <EOL> import easypost <EOL> easypost . api_key = '<STR_LIT>' <EOL> from_address = easypost . Address . create ( <EOL> name = "<STR_LIT>" , <EOL> street1 = "<STR_LIT>" , <EOL> street2 = "<STR_LIT>" , <EOL> city = "<STR_LIT>" , <EOL> state = "<STR_LIT>" , <EOL> zip = "<STR_LIT>" , <EOL> phone = "<STR_LIT>" <EOL> ) <EOL> parcel = easypost . Parcel . create ( <EOL> predefined_package = "<STR_LIT>" , <EOL> weight = <NUM_LIT:64> <EOL> ) <EOL> order_list = [ { <EOL> '<STR_LIT:address>' : { <EOL> '<STR_LIT:name>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT:state>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" <EOL> } , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ] <EOL> shipments = [ ] <EOL> for order in order_list : <EOL> shipments . append ( { <EOL> '<STR_LIT>' : order [ '<STR_LIT:address>' ] , <EOL> '<STR_LIT>' : from_address , <EOL> '<STR_LIT>' : parcel , <EOL> '<STR_LIT>' : order [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> batch = easypost . Batch . create_and_buy ( shipment = shipments ) <EOL> while batch . state in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> sleep ( <NUM_LIT:5> ) <EOL> batch . refresh ( ) <EOL> print ( batch . state ) <EOL> if batch . state == "<STR_LIT>" : <EOL> for shipment in batch . shipments : <EOL> shipment . insure ( amount = <NUM_LIT:100> ) <EOL> print ( batch ) </s>
