diff --git a/API_Github.ipynb b/API_Github.ipynb new file mode 100644 index 0000000..20fa3b2 --- /dev/null +++ b/API_Github.ipynb @@ -0,0 +1,155 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "k3K7iK_dBMuK" + }, + "outputs": [], + "source": [ + "#GitHub User Analyzer — a tool that connects to the GitHub API to fetch and display useful information about a user's public GitHub account.\n", + "#You’ll start by allowing a user to enter a GitHub username, then retrieve and show key details such as their profile info, list of public repositories, most-used programming languages, and popular projects.\n", + "\n", + "## Expected output:\n", + "\n", + "# GitHub Profile: torvalds\n", + "# Name: Linus Torvalds\n", + "# Username: torvalds\n", + "# Bio: Software engineer, creator of Linux\n", + "# Public Repos: 6\n", + "# Followers: 250K\n", + "# Following: 0\n", + "# Location: Portland, OR\n", + "# Profile URL: https://github.com/torvalds\n", + "\n", + "# Repositories ---------------------\n", + "\n", + "# project1\n", + "# View Repo (link here)\n", + "# Stars: 160K\n", + "# Language: C\n", + "# Last Updated: 2024-10-02\n", + "\n", + "# project2\n", + "# View Repo (link here)\n", + "# Stars: 4.5K\n", + "# Language: C++\n", + "# Last Updated: 2023-09-18\n", + "\n", + "# project3\n", + "# View Repo (link here)\n", + "# Stars: 230\n", + "# Language: Assembly\n", + "# Last Updated: 2021-01-11\n", + "\n", + "\n", + "# Most Used Languages\n", + "# Python (80%)\n", + "# SQL (10%)\n", + "\n", + "# Most Starred Repos\n", + "# project1 – 160K stars\n", + "# project2 – 4.5K stars\n", + "# linux-project3 – 1.2K stars" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import requests\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "OWNER = input(\"Enter username:\")\n", + "#REPO = input(f'Enter ')\n", + "\n", + "\n", + "url = f\"https://api.github.com/users/{OWNER}\"\n", + "\n", + "\n", + "response = requests.get(url)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "46" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response.json()[\"followers\"]\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "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.13.3" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}