Skip to content
Open

lab #305

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions API_Github.ipynb
Original file line number Diff line number Diff line change
@@ -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": [
"<Response [200]>"
]
},
"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
}