File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # scratchattach
2+
3+ Scratchattach is a scratch-API wrapper. This directory documents the WIP asynchronous API.
4+
5+ ## Logging in
6+
7+ ### Logging in with username & password:
8+
9+ ``` py
10+ import os
11+ import asyncio
12+ import scratchattach.async_api as sa
13+ from dotenv import load_dotenv
14+
15+ load_dotenv()
16+
17+ async def main ():
18+ async with await sa.login(os.environ[" SA_USERNAME" ], os.environ[" SA_PASSWORD" ]) as sess:
19+ print (sess.user_id)
20+
21+ if __name__ == " __main__" :
22+ asyncio.run(main())
23+ ```
24+
25+ ### Logging in with session id
26+
27+ ``` py
28+ import os
29+ import asyncio
30+ import scratchattach.async_api as sa
31+ from dotenv import load_dotenv
32+
33+ load_dotenv()
34+
35+ async def main ():
36+ async with await sa.login_by_id(os.environ[" SA_ID" ]) as sess:
37+ print (sess.user_id)
38+
39+ if __name__ == " __main__" :
40+ asyncio.run(main())
41+ ```
You can’t perform that action at this time.
0 commit comments