{ "cells": [ { "metadata": { "ExecuteTime": { "end_time": "2025-06-08T16:23:31.534793Z", "start_time": "2025-06-08T16:23:31.531154Z" } }, "cell_type": "code", "source": [ "from globals import *\n", "DEFAULT_API_URL = \"https://agents-course-unit4-scoring.hf.space\"\n", "api_url = DEFAULT_API_URL\n", "questions_url = f\"{api_url}/questions\"\n", "submit_url = f\"{api_url}/submit\"\n", "file_url = f\"{api_url}/files\"" ], "id": "f59c08d782ebc6bd", "outputs": [], "execution_count": 4 }, { "metadata": { "ExecuteTime": { "end_time": "2025-06-08T15:07:07.789828Z", "start_time": "2025-06-08T15:07:07.098834Z" } }, "cell_type": "code", "source": [ "response = requests.get(questions_url, timeout=15)\n", "response.raise_for_status()\n", "questions_data = response.json()" ], "id": "81985fdf7fcffcc9", "outputs": [], "execution_count": 2 }, { "metadata": { "ExecuteTime": { "end_time": "2025-06-08T16:30:24.102354Z", "start_time": "2025-06-08T16:30:24.099451Z" } }, "cell_type": "code", "source": [ "for item_num, item in enumerate(questions_data):\n", " # dict_keys(['task_id', 'question', 'Level', 'file_name'])\n", " # print(item['question'])\n", " if item['file_name'] != '':\n", " print(f\"Task {item_num} has file: {item['file_name']}\")\n", " # print(f\"The question: \\n {item['question']} \\n\")" ], "id": "28fe3ba72aa61a85", "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Task 3 has file: cca530fc-4052-43b2-b130-b30968d8aa44.png\n", "Task 9 has file: 99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3\n", "Task 11 has file: f918266a-b3e0-4914-865d-4faa564f1aef.py\n", "Task 13 has file: 1f975693-876d-457b-a649-393859e79bf3.mp3\n", "Task 18 has file: 7bd855d8-463d-4ed5-93ca-5fe35145f733.xlsx\n" ] } ], "execution_count": 10 }, { "metadata": { "ExecuteTime": { "end_time": "2025-06-08T16:38:46.821091Z", "start_time": "2025-06-08T16:38:46.143120Z" } }, "cell_type": "code", "source": [ "# dict_keys(['task_id', 'question', 'Level', 'file_name'])\n", "item_num = 18\n", "item = questions_data[item_num]\n", "print('---')\n", "print(f\"{item['task_id']}\")\n", "print(f\"Task {item_num} has file: {item['file_name']}\")\n", "\n", "response = requests.get(f\"{file_url}/{item['task_id']}\", timeout=15)\n", "response.raise_for_status()\n", "file_data = response.url\n", "print(file_data)\n", "print('---')" ], "id": "829cb65e4c515908", "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "---\n", "7bd855d8-463d-4ed5-93ca-5fe35145f733\n", "Task 18 has file: 7bd855d8-463d-4ed5-93ca-5fe35145f733.xlsx\n", "https://agents-course-unit4-scoring.hf.space/files/7bd855d8-463d-4ed5-93ca-5fe35145f733\n", "---\n" ] } ], "execution_count": 14 }, { "metadata": { "ExecuteTime": { "end_time": "2025-06-08T16:29:01.814363Z", "start_time": "2025-06-08T16:29:01.811569Z" } }, "cell_type": "code", "source": "\n", "id": "6108349553a14924", "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "https://agents-course-unit4-scoring.hf.space/files/cca530fc-4052-43b2-b130-b30968d8aa44\n", "---\n" ] } ], "execution_count": 9 }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": "", "id": "f3cca13bc30bca7b" } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }