From 337197f891ded7f5d82d64b69d3e0e2fddd46530 Mon Sep 17 00:00:00 2001 From: michesquivel <90282268+michesquivel@users.noreply.github.com> Date: Thu, 25 Nov 2021 16:19:39 -0600 Subject: [PATCH] subiendo desafios --- your-code/challenge_1.ipynb | 134 ++++++++++++++++++++++++++++++++++++ your-code/challenge_2.ipynb | 87 +++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 your-code/challenge_1.ipynb create mode 100644 your-code/challenge_2.ipynb diff --git a/your-code/challenge_1.ipynb b/your-code/challenge_1.ipynb new file mode 100644 index 0000000..aa4b26f --- /dev/null +++ b/your-code/challenge_1.ipynb @@ -0,0 +1,134 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 6, + "id": "8ab330cb", + "metadata": {}, + "outputs": [], + "source": [ + "import requests\n", + "import re\n", + "from operator import itemgetter\n", + "\n", + "username = 'michesquivel'\n", + "token = ''" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "531c15bd", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "https://api.github.com/repos/TheIronhidex/mad-oct-2018/languages\n", + "https://api.github.com/repos/techols/mad-oct-2018/languages\n", + "https://api.github.com/repos/luisbang/mad-oct-2018/languages\n", + "https://api.github.com/repos/Forastierii/mad-oct-2018/languages\n", + "https://api.github.com/repos/ToniPons97/mad-oct-2018/languages\n", + "https://api.github.com/repos/rsennes/mad-oct-2018/languages\n", + "https://api.github.com/repos/gggfaria/mad-oct-2018/languages\n", + "https://api.github.com/repos/nancyulric/mad-oct-2018/languages\n", + "https://api.github.com/repos/lmartinezruizit/datamad0119/languages\n", + "https://api.github.com/repos/eye8/madrid-oct-2018/languages\n", + "https://api.github.com/repos/ArieHassan/madrid-oct-2018/languages\n", + "https://api.github.com/repos/cmvalma/Ironhack-oct-2018/languages\n", + "https://api.github.com/repos/criraca/madrid-oct-2018/languages\n", + "https://api.github.com/repos/AlbertoCastellanos/madrid-oct-2018/languages\n", + "https://api.github.com/repos/elenajpp/madrid-oct-2018/languages\n", + "https://api.github.com/repos/miriammg/madrid-oct-2018/languages\n", + "https://api.github.com/repos/albertogcmr/madrid-oct-2018/languages\n", + "https://api.github.com/repos/marisfont/madrid-oct-2018/languages\n" + ] + } + ], + "source": [ + "requestA = requests.get('http://api.github.com/repos/ironhack-datalabs/madrid-oct-2018/forks')\n", + "resultados = requestA.json()\n", + "#print(resultados)\n", + "idiomas=[]\n", + "for res in resultados:\n", + " print ( res.get('languages_url'))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "b7be72a9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[None, 'Jupyter Notebook', 'HTML']\n" + ] + } + ], + "source": [ + "import json\n", + "import requests\n", + "requestA = requests.get('http://api.github.com/repos/ironhack-datalabs/madrid-oct-2018/forks')\n", + "resultados = requestA.json()\n", + "#print(resultados)\n", + "idiomas=[]\n", + "# python sale como valor None\n", + "for res in resultados:\n", + " lenguaje=res.get('language')\n", + " #print(lenguaje)\n", + " if lenguaje not in idiomas:\n", + " idiomas.append(lenguaje)\n", + "print(idiomas)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "8524ed57", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Jupyter Notebook', 'HTML', 'Python']\n" + ] + } + ], + "source": [ + "idiomas2=requests.get('http://api.github.com/repos/ironhack-datalabs/madrid-oct-2018/languages')\n", + "resultados2=idiomas2.json()\n", + "#print(resultados2.keys())\n", + "idiomas3=[]\n", + "for i in resultados2:\n", + " idiomas3.append(i)\n", + "print(idiomas3)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/your-code/challenge_2.ipynb b/your-code/challenge_2.ipynb new file mode 100644 index 0000000..21492a1 --- /dev/null +++ b/your-code/challenge_2.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "6db1616f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'Marc Pomar', 'email': 'marc@faable.com', 'date': '2019-08-19T11:11:36Z'}\n", + "{'name': 'ta-data-bcn', 'email': '47005065+ta-data-bcn@users.noreply.github.com', 'date': '2019-03-07T15:49:16Z'}\n", + "{'name': 'ta-data-bcn', 'email': '47005065+ta-data-bcn@users.noreply.github.com', 'date': '2019-03-07T15:38:52Z'}\n", + "{'name': 'Tony Ojeda', 'email': 'tojeda@districtdatalabs.com', 'date': '2019-01-18T18:28:33Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-17T21:59:35Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-17T06:33:16Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-17T06:28:16Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-17T06:24:01Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-16T23:20:01Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-16T22:24:40Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-16T22:24:35Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-14T22:40:53Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-11T20:01:48Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-10T21:15:16Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-10T21:11:31Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-08T20:22:14Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-08T20:22:09Z'}\n", + "{'name': 'Tony Ojeda', 'email': 'tojeda@districtdatalabs.com', 'date': '2019-01-07T20:24:29Z'}\n", + "{'name': 'Tony Ojeda', 'email': 'tojeda@districtdatalabs.com', 'date': '2019-01-07T20:20:17Z'}\n", + "{'name': 'Tony Ojeda', 'email': 'tojeda@districtdatalabs.com', 'date': '2019-01-07T17:49:55Z'}\n", + "{'name': 'Tony Ojeda', 'email': 'tojeda@districtdatalabs.com', 'date': '2019-01-07T17:47:26Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-07T16:32:06Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-07T16:17:21Z'}\n", + "{'name': 'Tony Ojeda', 'email': 'tojeda@districtdatalabs.com', 'date': '2019-01-07T15:15:49Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-07T05:11:44Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-06T20:04:06Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-05T17:05:30Z'}\n", + "{'name': 'Zhou Zhou', 'email': 'zhou.eye8@gmail.com', 'date': '2019-01-05T17:05:18Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-05T02:21:03Z'}\n", + "{'name': 'Michal Monselise', 'email': 'michal.monselise@gmail.com', 'date': '2019-01-05T02:20:54Z'}\n", + "30\n" + ] + } + ], + "source": [ + "import json\n", + "import requests\n", + "requestA = requests.get('http://api.github.com/repos/ironhack-datalabs/madrid-oct-2018/commits')\n", + "resultados = requestA.json()\n", + "\n", + "contador = 0\n", + "\n", + "for res in resultados:\n", + " commit = res.get('commit')\n", + " author = commit.get('author')\n", + " print (author)\n", + " date = author.get('date')\n", + " #print (date)\n", + " contador = contador+1\n", + "print (contador)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}