Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def get_quote(self, address, city, state, zipcode):
""" """
if not self.__token:
self.get_token_bearer()
assert len(state) == 2
resp = requests.request(
"POST",
'%s/Services/API/v1/Quote' % (self.__base_url),
headers={
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer %s' % self.__token,
},
data={
"BuildingCoverage": "250000",
"ContentsCoverage": "100000",
"DateOfConstruction": "01/01/1914",
"BuildingUsage": "1",
"FoundationType": FOUNDATION_TYPE['BASEMENT_BELOW_GRADE'],
"StructureType": "Dwelling",
"InsuredType": "Owner",
"NumberOfFamilies": "1 Family",
"NumberOfStories": "2",
"InsuredFirstName": "John",
"InsuredLastName": "Doe",
"PropertyAddressLine1": str(address),
"PropertyAddressCity": str(city),
"PropertyAddressState": str(state),
"PropertyAddressPostalCode": str(zipcode),
"TrackingID": "13233880", # we
},
)
assert resp.status_code == 200
response_json = json.loads(resp.text)
return response_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment