Skip to content

Instantly share code, notes, and snippets.

@kassuts
Created January 20, 2019 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kassuts/eb4f546b00adc8ce8dadac78baec070b to your computer and use it in GitHub Desktop.
Save kassuts/eb4f546b00adc8ce8dadac78baec070b to your computer and use it in GitHub Desktop.
def aylien_api_connect(params, app_id, app_key, api_version):
# Define the API endpoint you would like to use - in this case "concepts".
endpoint = "concepts"
headers = {
'Accept': 'application/json',
'Content-type': 'application/x-www-form-urlencoded',
'X-AYLIEN-TextAPI-Application-ID': app_id,
'X-AYLIEN-TextAPI-Application-Key': app_key,
'User-Agent': "Aylien Text API Python " + api_version
}
url = 'https://api.aylien.com/api/v1' + "/" + endpoint
response = requests.post(url, headers=headers, params=params)
content = json.loads(response.content)
return content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment