-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub API basic app
More file actions
41 lines (32 loc) · 1.22 KB
/
github API basic app
File metadata and controls
41 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#Request module
from typing import _SpecialForm
import requests
import json
class Github:
def __init__(self):
self.api_url="https://api.github.com"
def getUser(self,username):
response = requests.get(self.api_url+"/users/"+username)
return response.json()
def getRepositories(self,username):
response = requests.get(self.api_url+"/users/"+username+"/repos")
return response.json()
def createRepository(self,name):
print("this function is belong to user's github's access code ")
print("it doesnt working cause it depends on the user")
github = Github()
while True:
secim = input("1-Find user\n2- Get Repositories\n3-Create repositories\n4-Exit\nSecim:...")
if(secim == "4"):
break
elif(secim =="1"):
username=input("username bilgisi giriniz:")
result = github.getUser(username)
print(f"name:{result['name']} public repos: {result['public_repos']} followers: {result['followers']}")
elif(secim =="2"):
username=input("username bilgisi giriniz:")
result = github.getRepositories(username)
for repo in result:
print(repo["name"])
elif(secim =="3"):
pass