@@ -14,8 +14,10 @@ Install and update using pip:
1414
1515` pip install githubapps.py `
1616
17+ # examples
1718A simple example.
18-
19+
20+ ## Sync
1921``` python
2022import githubapps
2123def 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```
0 commit comments