I've been following a tutorial to create a Form from Python using the Forms API. I'm using a service account to create the form, and it does it alright. My question is: where is it stored? Does the service account have a Drive storage unit? If so, where can I see it?
On a similar note, can I create a Form using the Forms API in a specific folder?
Here's the code.
from apiclient import discovery
from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
import json
SCOPES = "https://www.googleapis.com/auth/forms.body"
DISCOVERY_DOC = "https://forms.googleapis.com/$discovery/rest?version=v1"
creds = ServiceAccountCredentials.from_json_keyfile_name(
'credencial.json',
SCOPES
)
http = creds.authorize(Http())
form_service = discovery.build(
'forms',
'v1',
http=http,
discoveryServiceUrl=DISCOVERY_DOC,
static_discovery=False
)
NEW_FORM = {
"info":{
"title": "Mi formulario"
}
}
NEW_QUESTION = {
"requests": [{
"createItem": {
"item": {
"title": "¿Qué es una pregunta?",
"questionItem": {
"question": {
"required": False,
"textQuestion": {
"paragraph": False
}
}
}
},
"location": {
"index": 0
}
}
}]
}
result = form_service.forms().create(
body = NEW_FORM
).execute()
question_setting = form_service.forms().batchUpdate(
formId=result["formId"],
body=NEW_QUESTION
).execute()
get_result = form_service.forms().get(
formId=result["formId"]
).execute()
print(json.dumps(get_result, indent=4))
Tried the previous code, expected to find a Google Drive somewhere associated to the service account that was used to create the Form.