{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"### How to make submissions using Kaggle's API","metadata":{}},{"cell_type":"code","source":"# pip install kaggle","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-02-14T09:05:16.876764Z","iopub.execute_input":"2022-02-14T09:05:16.877085Z","iopub.status.idle":"2022-02-14T09:05:16.897862Z","shell.execute_reply.started":"2022-02-14T09:05:16.877002Z","shell.execute_reply":"2022-02-14T09:05:16.896848Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Start by obtaining the API on https://www.kaggle.com/yourusername/account","metadata":{}},{"cell_type":"code","source":"import os\nos.environ[\"KAGGLE_USERNAME\"]=\"yourusername\"\nos.environ[\"KAGGLE_KEY\"]=\"yourapikey\"","metadata":{"execution":{"iopub.status.busy":"2022-02-14T09:05:16.899913Z","iopub.execute_input":"2022-02-14T09:05:16.900258Z","iopub.status.idle":"2022-02-14T09:05:16.914933Z","shell.execute_reply.started":"2022-02-14T09:05:16.900212Z","shell.execute_reply":"2022-02-14T09:05:16.914299Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!kaggle competitions list","metadata":{"execution":{"iopub.status.busy":"2022-02-14T09:05:16.916344Z","iopub.execute_input":"2022-02-14T09:05:16.916590Z","iopub.status.idle":"2022-02-14T09:05:17.718247Z","shell.execute_reply.started":"2022-02-14T09:05:16.916559Z","shell.execute_reply":"2022-02-14T09:05:17.717249Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### List competitition files","metadata":{}},{"cell_type":"code","source":"!kaggle competitions files h-and-m-personalized-fashion-recommendations","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-02-14T09:05:17.719781Z","iopub.execute_input":"2022-02-14T09:05:17.720077Z","iopub.status.idle":"2022-02-14T09:05:19.216875Z","shell.execute_reply.started":"2022-02-14T09:05:17.720042Z","shell.execute_reply":"2022-02-14T09:05:19.215938Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Make a submission ","metadata":{}},{"cell_type":"code","source":"!kaggle competitions submit -c h-and-m-personalized-fashion-recommendations  -f ../input/h-and-m-personalized-fashion-recommendations/sample_submission.csv -m \"Submission via API\"","metadata":{"execution":{"iopub.status.busy":"2022-02-14T09:05:19.218738Z","iopub.execute_input":"2022-02-14T09:05:19.218950Z","iopub.status.idle":"2022-02-14T09:05:23.299302Z","shell.execute_reply.started":"2022-02-14T09:05:19.218923Z","shell.execute_reply":"2022-02-14T09:05:23.298387Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Check the leaderboard","metadata":{}},{"cell_type":"code","source":"!kaggle competitions submissions -c h-and-m-personalized-fashion-recommendations ","metadata":{"execution":{"iopub.status.busy":"2022-02-14T09:05:23.301421Z","iopub.execute_input":"2022-02-14T09:05:23.301720Z","iopub.status.idle":"2022-02-14T09:05:24.184975Z","shell.execute_reply.started":"2022-02-14T09:05:23.301685Z","shell.execute_reply":"2022-02-14T09:05:24.184043Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!kaggle competitions  leaderboard h-and-m-personalized-fashion-recommendations --show","metadata":{"execution":{"iopub.status.busy":"2022-02-14T09:05:24.186549Z","iopub.execute_input":"2022-02-14T09:05:24.186774Z","iopub.status.idle":"2022-02-14T09:05:25.073081Z","shell.execute_reply.started":"2022-02-14T09:05:24.186746Z","shell.execute_reply":"2022-02-14T09:05:25.072423Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Learn more on [GitHub](https://github.com/Kaggle/kaggle-api) and [Kaggle](https://www.kaggle.com/docs/api)","metadata":{}}]}