To export data from a tally form and access it in Python using an API, you'll need to perform the following steps:
pip install requests
in your terminal or command prompt.Here's an example of how you can access the Tally API in Python:
import requests
import json
# Replace <YOUR_API_KEY> with your actual Tally API key
api_key = "<YOUR_API_KEY>"
headers = {"Authorization": f"Bearer {api_key}"}
# Replace <YOUR_FORM_ID> with the ID of your Tally form
form_id = "<YOUR_FORM_ID>"
url = f"<https://api.tally.so/v1/forms/{form_id}/responses>"
response = requests.get(url, headers=headers)
if response.status_code == 200:
form_data = json.loads(response.text)
print("Form data fetched successfully")
print(form_data)
else:
print(f"Error fetching form data. Status code: {response.status_code}")