github-conn 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ from .client import GitHubClient
github_conn/client.py ADDED
@@ -0,0 +1,25 @@
1
+ import requests
2
+
3
+ class GitHubClient:
4
+ def __init__(self, token=None):
5
+ self.base_url = "https://api.github.com"
6
+ self.headers = {
7
+ "Accept": "application/vnd.github+json",
8
+ "X-GitHub-Api-Version": "2022-11-28"
9
+ }
10
+ if token:
11
+ self.headers["Authorization"] = f"Bearer {token}"
12
+
13
+ def get_user(self, username):
14
+ url = f"{self.base_url}/users/{username}"
15
+ response = requests.get(url, headers=self.headers)
16
+ if response.status_code == 200:
17
+ return response.json()
18
+ response.raise_for_status()
19
+
20
+ def get_repos(self, username):
21
+ url = f"{self.base_url}/users/{username}/repos"
22
+ response = requests.get(url, headers=self.headers)
23
+ if response.status_code == 200:
24
+ return response.json()
25
+ response.raise_for_status()
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.5
2
+ Name: github_conn
3
+ Version: 0.1.0
4
+ Summary: Un pacchetto semplice per connettersi alle API di GitHub
5
+ Project-URL: Homepage, https://github.com/Dal-Canto/github_conn
6
+ Author-email: Alessandro <gargoalexdc@gmail.com>
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.8
11
+ Requires-Dist: requests>=2.28.0
12
+ Description-Content-Type: text/markdown
13
+
14
+ # github_conn
15
+
16
+ Un pacchetto Python per connettersi all'API di GitHub, sviluppato da Alessandro.
@@ -0,0 +1,5 @@
1
+ github_conn/__init__.py,sha256=ZAOzW9juFloiP4EcpUPHyoPIlQSnsrizgDx0xYVucik,33
2
+ github_conn/client.py,sha256=KJs1e3nIpJ1rGvbH1Luq-58qjlfj-A2UsjtfiE83NjQ,856
3
+ github_conn-0.1.0.dist-info/METADATA,sha256=uE9rJgEUxt94OMPBFcGgoridKvkCE1ebQ4r-ZW_QTlo,572
4
+ github_conn-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
5
+ github_conn-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any