示例#1
0
    def parse(self, address):
        """
        Returns an Address dictionary with the components of the queried
        address.

        >>> client = GeocodioClient('some_api_key')
        >>> client.parse("1600 Pennsylvania Ave, Washington DC")
        {
            "address_components": {
                "number": "1600",
                "street": "Pennsylvania",
                "suffix": "Ave",
                "city": "Washington",
                "state": "DC"
            },
            "formatted_address": "1600 Pennsylvania Ave, Washington DC"
        }
        """
        response = self._req(verb="parse", params={'q': address})
        if response.status_code != 200:
            return error_response(response)
        return Address(response.json())
示例#2
0
 def test_address_accuracy(self):
     """Ensure Address.accuracy property returns None when no location"""
     x = Address(self.address_response)
     self.assertEqual(None, x.accuracy)
示例#3
0
 def test_address_coords(self):
     """Ensure Address.coords property returns None when no location"""
     x = Address(self.address_response)
     self.assertEqual(None, x.coords)