Setting-Up Python SDK
The Python SDK is available for installation via pypi repository:
Create a folder for your Python project. Run this command to create an empty project:
pip init
To install Python SDK client to your local project, simply execute:
pip install com.precisely.apis
To deploy it globally, simply execute:
pip install -g preciselyapis-client
Now, you must set-up API Key & Secret in the Python SDK. Obtain your API Key and Secret from your developer account. See 'Obtaining Credentials (API Key and Secret)'.
Create an empty Python file and paste this code snippet:
//We are getting refrence to the installed preciselyapis package
from com.precisely.apis.api.address_autocomplete_service_api import AddressAutocompleteServiceApi
from com.precisely.apis.exceptions import ApiException
def addressAutocompleteExample():
api = AddressAutocompleteServiceApi()
api.api_client.oAuthApiKey = "PUT_YOUR_KEY_HERE"
api.api_client.oAuthSecret = "PUT_YOUR_SECRET_HERE"
api.api_client.generateAndSetToken()
try:
response = api.search_v2("times sq", country="usa")
print(response)
except ApiException as e:
print(e.body)
if _name_ == "_main_":
addressAutocompleteExample()
In the above code snippet, put your API key and Secret from your developer account:
oAuth.oAuthApiKey="API_KEY";
oAuth.oAuthSecret="SECRET";