diff --git a/fedex/services/location_service.py b/fedex/services/location_service.py index 9d47a1c..f7db850 100644 --- a/fedex/services/location_service.py +++ b/fedex/services/location_service.py @@ -52,6 +52,9 @@ def __init__(self, config_obj, *args, **kwargs): self.SortDetail = None """@ivar: Holds the LocationSortDetail WSDL object.""" + self.GeographicCoordinates = None + """@ivar: Holds the GeographicCoordinates WSDL object.""" + super(FedexSearchLocationRequest, self).__init__( self._config_obj, 'LocationsService_v9.wsdl', *args, **kwargs) @@ -65,6 +68,7 @@ def _prepare_wsdl_objects(self): self.Constraints = self.create_wsdl_object_of_type('SearchLocationConstraints') self.Address = self.create_wsdl_object_of_type('Address') self.LocationsSearchCriterion = 'ADDRESS' + self.GeographicCoordinates = None self.SortDetail = self.create_wsdl_object_of_type('LocationSortDetail') def _assemble_and_send_request(self): @@ -94,4 +98,5 @@ def _assemble_and_send_request(self): MultipleMatchesAction=self.MultipleMatchesAction, Constraints=self.Constraints, Address=self.Address, - SortDetail=self.SortDetail) + SortDetail=self.SortDetail, + GeographicCoordinates=self.GeographicCoordinates) diff --git a/tests/test_location_service.py b/tests/test_location_service.py index 107ad5d..26054a3 100644 --- a/tests/test_location_service.py +++ b/tests/test_location_service.py @@ -47,7 +47,18 @@ def test_location_address_search(self): location_request = FedexSearchLocationRequest(CONFIG_OBJ) location_request.Address.PostalCode = '38119' location_request.Address.CountryCode = 'US' + + 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' if __name__ == "__main__": logging.basicConfig(stream=sys.stdout, level=logging.INFO)