Skip to content

Instantly share code, notes, and snippets.

@sudotong
Created January 6, 2021 00:33
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudotong/d4b409f4de790597f049c0e446bf8a67 to your computer and use it in GitHub Desktop.
Save sudotong/d4b409f4de790597f049c0e446bf8a67 to your computer and use it in GitHub Desktop.
An example on connecting to the Fireflies API with Python 3
# An example to get some data using the Fireflies GraphQL API
import requests
headers = {"Authorization": "Bearer YOUR-TOKEN-GOES-HERE"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.fireflies.ai/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
return request.json()
else:
raise Exception("Query failed to run by returning code of {}. {}".format(request.status_code, query))
# The GraphQL query (with a few aditional bits included) itself defined as a multi-line string.
query = """
{
user {
email
recent_transcript
}
}
"""
result = run_query(query) # Execute the query
recent_transcript = result["data"]["user"]["recent_transcript"] # Drill down the dictionary
print("Most recent transcript from user - {}".format(recent_transcript))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment