Skip to content

Commit 353c1f5

Browse files
committed
fix: v1.1.0
1 parent 907d12a commit 353c1f5

File tree

6 files changed

+36
-26
lines changed

6 files changed

+36
-26
lines changed

README.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ Install and update using pip:
1414

1515
`pip install githubapps.py`
1616

17+
# examples
1718
A simple example.
18-
19+
20+
## Sync
1921
```python
2022
import githubapps
2123
def main():
@@ -26,7 +28,30 @@ def main():
2628
with open('env/installation_id.key', 'r') as f_installation_id:
2729
installation_id = f_installation_id.read()
2830
client_secret = private_key
29-
auth = githubapps.Auth(app_id, installation_id, client_secret)
31+
auth = githubapps.RequestsAuth(app_id, installation_id, client_secret)
3032
access_token = auth.get_access_token()
3133
print(access_token)
34+
35+
if __name__ == "__main__":
36+
main()
37+
```
38+
## Async
39+
```python
40+
import githubapps
41+
import asyncio
42+
43+
async def main():
44+
with open('env/private.key', 'rb') as f_private:
45+
private_key = f_private.read()
46+
with open('env/app_id.key', 'r') as f_app_id:
47+
app_id = f_app_id.read()
48+
with open('env/installation_id.key', 'r') as f_installation_id:
49+
installation_id = f_installation_id.read()
50+
client_secret = private_key
51+
auth = githubapps.AiohttpAuth(app_id, installation_id, client_secret)
52+
access_token = await auth.get_access_token()
53+
print(access_token)
54+
55+
if __name__ == "__main__":
56+
asyncio.run(main())
3257
```

example/requirements.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
PyJWT
2-
aiohttp
3-
requests
4-
cryptography
5-
PyGithub
1+
githubapps.py
2+
asyncio

example/test.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
21
import githubapps
3-
from github import Github
4-
5-
# using an access token
6-
7-
82
def main():
93
with open('env/private.key', 'rb') as f_private:
104
private_key = f_private.read()
@@ -15,8 +9,7 @@ def main():
159
client_secret = private_key
1610
auth = githubapps.RequestsAuth(app_id, installation_id, client_secret)
1711
access_token = auth.get_access_token()
18-
19-
g = Github(access_token)
2012
print(access_token)
13+
2114
if __name__ == "__main__":
22-
main()
15+
main()

example/testasync.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
21
import githubapps
3-
from github import Github
42
import asyncio
53

6-
# using an access token
7-
8-
94
async def main():
105
with open('env/private.key', 'rb') as f_private:
116
private_key = f_private.read()
@@ -16,8 +11,7 @@ async def main():
1611
client_secret = private_key
1712
auth = githubapps.AiohttpAuth(app_id, installation_id, client_secret)
1813
access_token = await auth.get_access_token()
19-
20-
g = Github(access_token)
2114
print(access_token)
15+
2216
if __name__ == "__main__":
23-
asyncio.run(main())
17+
asyncio.run(main())

githubapps/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
__author__ = 'RTa-technology'
1010
__license__ = 'MIT'
1111
__copyright__ = 'Copyright 2022 by the authors and contributors (see AUTHORS)'
12-
__version__ = '1.0.0'
12+
__version__ = '1.1.0'
1313

1414
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
1515

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PyJWT
22
aiohttp
33
requests
4-
cryptography
4+
cryptography
5+
httpx

0 commit comments

Comments
 (0)