Skip to content

Commit

Permalink
Added references to examples folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MujyKun committed Jul 6, 2021
1 parent 495efdc commit ecf263d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ import aiohttp
from Weverse.error import InvalidToken
from Weverse.weverseasync import WeverseClientAsync

# THERE IS A MORE DETAILED EXAMPLE IN THE EXAMPLES FOLDER
# https://github.com/MujyKun/Weverse/blob/main/examples/asynchronous.py

token = "fake_token" # REQUIRED
# It is advised to pass in your own web session as it is not closed in Weverse
web_session = aiohttp.ClientSession() # A session is created by default
Expand All @@ -61,6 +64,10 @@ import requests
from Weverse.weversesync import WeverseClientSync
from Weverse.error import InvalidToken


# THERE IS A MORE DETAILED EXAMPLE IN THE EXAMPLES FOLDER
# https://github.com/MujyKun/Weverse/blob/main/examples/synchronous.py

token = "fake_token" # REQUIRED
# It is advised to pass in your own web session as it is not closed in Weverse
web_session = requests.Session() # A session is created by default
Expand All @@ -75,5 +82,7 @@ except InvalidToken:
# if only the newer posts are wanted. More info on the documentation.

```
**[More Detailed Asynchronous Example](https://github.com/MujyKun/Weverse/blob/main/examples/asynchronous.py)**
**[More Detailed Synchronous Example](https://github.com/MujyKun/Weverse/blob/main/examples/synchronous.py)**

### **[API Documentation](https://weverse.readthedocs.io/en/latest/)**
6 changes: 6 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ Asynchronous Usage
from Weverse.error import InvalidToken
from Weverse.weverseasync import WeverseClientAsync
# THERE IS A MORE DETAILED EXAMPLE IN THE EXAMPLES FOLDER
# https://github.com/MujyKun/Weverse/blob/main/examples/asynchronous.py
token = "fake_token" # REQUIRED
# It is advised to pass in your own web session as it is not closed in Weverse
web_session = aiohttp.ClientSession()
Expand All @@ -172,6 +175,9 @@ Synchronous Usage
from Weverse.weversesync import WeverseClientSync
from Weverse.error import InvalidToken
# THERE IS A MORE DETAILED EXAMPLE IN THE EXAMPLES FOLDER
# https://github.com/MujyKun/Weverse/blob/main/examples/synchronous.py
token = "fake_token" # REQUIRED
# It is advised to pass in your own web session as it is not closed in Weverse
web_session = requests.Session() # A session is created by default
Expand Down
7 changes: 7 additions & 0 deletions examples/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,10 @@ async def loop_notifications(self):
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(Example().start())

# Please note that if you are running Weverse in a huge program and you are loading the entire cache, this should
# be run using asyncio.create_task
# Assuming you will not be running the Weverse section from the main part (this function) of your program,
# it would be advised to do something along the lines of the below line
# task = asyncio.create_task(Example().start())

0 comments on commit ecf263d

Please sign in to comment.