def setup(self): initialize_config(True) # with default config self.data = { "exam": { "name": "test1", }, "item_topics": [ { "item_id": "1", "tags": [{ "topic_tree": "Biology", "topic_branch_hierarchy": { "0": "Cell biology", "1": "Cells", "2": "Organelles", "3": "Nucleus" }, "topic_tagged": "DNA", "scored": "Y" }, { "topic_tree": "Biology", "topic_branch_hierarchy": { "0": "Cell biology", "1": "Cells", "2": "Organelles" }, "topic_tagged": "Ribosomes", "scored": "Y" }] }, { "item_id": "2", "tags": [{ "topic_tree": "A", "topic_branch_hierarchy": { "0": "B", "1": "C", "2": "D", "3": "E" }, "topic_tagged": "f", "scored": "Y" }, { "topic_tree": "A", "topic_branch_hierarchy": { "0": "B", "1": "C", "2": "D" }, "topic_tagged": "e", "scored": "Y" }] }, { "item_id": "3", "tags": [{ "topic_tree": "G", "topic_branch_hierarchy": { "0": "H", "1": "I", "2": "J", "3": "K" }, "topic_tagged": "l", "scored": "Y" }, { "topic_tree": "G", "topic_branch_hierarchy": { "0": "H", "1": "I", "2": "J" }, "topic_tagged": "k", "scored": "Y" }] }, { "item_id": "4", "tags": [{ "topic_tree": "M", "topic_branch_hierarchy": { "0": "N", "1": "O", "2": "P", "3": "Q" }, "topic_tagged": "r", "scored": "Y" }, { "topic_tree": "M", "topic_branch_hierarchy": { "0": "N", "1": "O", "2": "P", }, "topic_tagged": "q", "scored": "Y" }] }, { "item_id": "5", "tags": [{ "topic_tree": "A", "topic_branch_hierarchy": { "0": "B", "1": "C", "2": "D", "3": "E" }, "topic_tagged": "f", "scored": "Y" }, { "topic_tree": "m", "topic_branch_hierarchy": { "0": "n", "1": "o", "2": "p", }, "topic_tagged": "q", "scored": "Y" }] }, { "item_id": "6", "tags": [{ "topic_tree": "a", "topic_branch_hierarchy": { "0": "b", "1": "c", "2": "d", "3": "e" }, "topic_tagged": "f", "scored": "Y" }, { "topic_tree": "M", "topic_branch_hierarchy": { "0": "N", "1": "O", "2": "P", }, "topic_tagged": "q", "scored": "Y" }] }, ], "student_list": [{ "group": ["2022", "class 1"], "id": "1234", "first_name": "John", "last_name": "Smith", "email": "*****@*****.**", "item_responses": [{ "item_id": "1", "response": 1 }, { "item_id": "2", "response": 0 }, { "item_id": "3", "response": 1 }, { "item_id": "4", "response": 1 }, { "item_id": "5", "response": 0 }, { "item_id": "6", "response": 1 }] }, { "group": ["2022"], "id": "1235", "first_name": "Jane", "last_name": "Smath", "email": "*****@*****.**", "item_responses": [{ "item_id": "1", "response": 0 }, { "item_id": "2", "response": 1 }, { "item_id": "3", "response": 1 }, { "item_id": "4", "response": 1 }, { "item_id": "5", "response": 1 }, { "item_id": "6", "response": 1 }] }, { "group": ["2024", "class 1"], "id": "1236", "first_name": "Jake", "last_name": "Jakey", "email": "*****@*****.**", "item_responses": [{ "item_id": "1", "response": 0 }, { "item_id": "2", "response": 1 }, { "item_id": "3", "response": 0 }, { "item_id": "4", "response": 0 }, { "item_id": "5", "response": 0 }, { "item_id": "6", "response": 1 }, { "item_id": "7", "response": 1 }] }], "exclude_items": [], "exclude_students": [] }
# Call the Apps Script API try: # Create a new project request = {'title': 'My Script'} response = service.projects().create(body=request).execute() # Upload two files to the project request = { 'files': [{ 'name': 'hello', 'type': 'SERVER_JS', 'source': SAMPLE_CODE }, { 'name': 'appsscript', 'type': 'JSON', 'source': SAMPLE_MANIFEST }] } response = service.projects().updateContent( body=request, scriptId=response['scriptId']).execute() print('https://script.google.com/d/' + response['scriptId'] + '/edit') except errors.HttpError as error: # The API encountered a problem. print(error.content) if __name__ == '__main__': initialize_config() creds = GoogleCredentials().get_credential_local() main(creds)
def __init__(self, *args, **kwargs): super(RMApp, self).__init__(*args, **kwargs) initialize_config()