def test_location_coordinates_search(self): # Test search by geo coordinates # https://www.fedex.com/us/developer/webhelp/ws/2020/US/FedEx_WebServices_2020_Developer_Guide.htm#t=wsdvg%2FLocation_Request_Coding_Details.htm location_request = FedexSearchLocationRequest(CONFIG_OBJ) location_request.LocationsSearchCriterion = 'GEOGRAPHIC_COORDINATES' location_request.Address.CountryCode = 'US' location_request.GeographicCoordinates = '34.074866096127096-118.40365442768258/' location_request.send_request() assert location_request.response.HighestSeverity == 'SUCCESS'
def location_service(self, credentials, from_address_doc, from_country_doc): from fedex.services.location_service import FedexSearchLocationRequest customer_transaction_id = "*** LocationService Request v3 using Python ***" # Optional transaction_id location_request = FedexSearchLocationRequest(credentials, \ customer_transaction_id=customer_transaction_id) location_request.Constraints.RadiusDistance.Value = self.radius location_request.Constraints.RadiusDistance.Units = self.radius_uom location_request.Address.PostalCode = from_address_doc.pincode[0:10] location_request.Address.CountryCode = from_country_doc.code location_request.send_request() response_dict = sobject_to_dict(location_request.response) frappe.msgprint(str(response_dict))
def test_location_phone_search(self): # Test location service phone query location_request = FedexSearchLocationRequest(CONFIG_OBJ) location_request.LocationsSearchCriterion = 'PHONE_NUMBER' location_request.PhoneNumber = '4169297819' location_request.MultipleMatchesAction = 'RETURN_ALL' location_request.Constraints.LocationTypesToInclude = ['FEDEX_AUTHORIZED_SHIP_CENTER'] location_request.Address.PostalCode = 'M5V 1Z0' location_request.Address.CountryCode = 'CA' location_request.send_request() assert location_request.response
# LOCATION_TYPE or DISTANCE (default) # Order can be LOWEST_TO_HIGHEST (default) or HIGHEST_TO_LOWEST # location_request.SortDetail.Criterion = 'LATEST_GROUND_DROPOFF_TIME' # location_request.SortDetail.Order = 'LOWEST_TO_HIGHEST' # If you'd like to see some documentation on the ship service WSDL, un-comment # this line. (Spammy). # print(rate_request.client) # Un-comment this to see your complete, ready-to-send request as it stands # before it is actually sent. This is useful for seeing what values you can # change. # print(location_request.LocationsSearchCriterion) # Fires off the request, sets the 'response' attribute on the object. location_request.send_request() # This will show the reply to your request being sent. You can access the # attributes through the response attribute on the request object. This is # good to un-comment to see the variables returned by the FedEx reply. # print(location_request.response) # This will convert the response to a python dict object. To # make it easier to work with. # from fedex.tools.conversion import basic_sobject_to_dict # print(basic_sobject_to_dict(location_request.response)) # This will dump the response data dict to json. # from fedex.tools.conversion import sobject_to_json # print(sobject_to_json(location_request.response))