-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathform2data.py
46 lines (30 loc) · 1.12 KB
/
form2data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import json
import urllib.request
def main():
# Insrtar Keys cuenta Typeform ( www.typeform.com )
usr = ""
key = ""
url = "https://api.typeform.com/v1/form/" + usr + "?" + "key=" + key
url_specs = "&" + "completed=true" + "&" + "order_by[]=date_submit,desc" # + "&" + "limit=10"
url = url + url_specs
page = urllib.request.urlopen(url)
content_bytes = page.read()
content = content_bytes.decode('utf8')
obj = json.loads(content)
##print(json.dumps(obj, indent=4)) ### NO BORRAR
completed = obj['stats']['responses'][
'completed'] # total de respuestas completadas
showing = obj['stats']['responses'][
'showing'] # total de respuestas que son mostradas
#print(completed)
#print(showing)
for i in range(showing):
respuesta = obj['responses'][i]['answers']['textarea_52850750']
email = obj['responses'][i]['answers']['email_52850524']
nombre = obj['responses'][i]['answers']['textfield_52850379']
print('\n')
print(nombre)
print(email)
print(respuesta)
if __name__ == "__main__":
main()