This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from valknight/feature/notifImprovements
Notification improvements
- Loading branch information
Showing
3 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
from cohost.models.user import User | ||
|
||
def main(): | ||
print('logging in... ') | ||
username = os.environ.get('cohostUser') | ||
password = os.environ.get('cohostPass') | ||
handle = os.environ.get('cohostHandle') | ||
if username is None: | ||
username = input('username: ') | ||
if password is None: | ||
password = input('password: ') | ||
if handle is None: | ||
handle = input('handle: ') | ||
user = User.login(username, password) | ||
|
||
print('done!', end='\n\n') | ||
# get last 10 notifications | ||
print('last 10 notifs: {}'.format(len(user.notifications)), end='\n\n') | ||
|
||
# example of custom pagination | ||
user.notificationsPagified(page = 2, notificationsPerPage=5) | ||
|
||
# Example of all notifications! | ||
print('retrieving all notifs... ') | ||
notifs = user.allNotifications | ||
print('you have recieved {} total lifetime notifs.'.format(len(notifs))) | ||
|
||
if __name__ == '__main__': | ||
main() |