Spaces:
Sleeping
Sleeping
File size: 612 Bytes
dabad6b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import requests
import json
def enviar_evento(email, evento):
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
data = {
"api_key": "f80efefa371aab8b7cde391020d33ed1",
"events": [{
"device_id": email,
"event_type": evento
}]
}
response = requests.post('https://api2.amplitude.com/2/httpapi',
headers=headers, data=json.dumps(data))
if response.status_code == 200:
print("Success:", response.json())
else:
print("Error:", response.text) |