From d8a7f4ebaab95e451436ababf15158871e8fc791 Mon Sep 17 00:00:00 2001 From: simonwt Date: Tue, 31 Mar 2026 22:42:41 +0100 Subject: [PATCH] feeds --- jobs/feed/__init__.py | 2 ++ jobs/feed/cafefeed.py | 9 +++++++++ jobs/feed/following.py | 9 +++++++++ testing.py | 12 +++++++++--- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 jobs/feed/__init__.py create mode 100644 jobs/feed/cafefeed.py create mode 100644 jobs/feed/following.py diff --git a/jobs/feed/__init__.py b/jobs/feed/__init__.py new file mode 100644 index 0000000..2c8c9ee --- /dev/null +++ b/jobs/feed/__init__.py @@ -0,0 +1,2 @@ +from .cafefeed import cafefeed +from .following import followingfeed \ No newline at end of file diff --git a/jobs/feed/cafefeed.py b/jobs/feed/cafefeed.py new file mode 100644 index 0000000..e42bee9 --- /dev/null +++ b/jobs/feed/cafefeed.py @@ -0,0 +1,9 @@ +def cafefeed(API): + """ + List all of a token's user's feed items. + + Returns: + A list of feed items. + """ + feed = API.make_request("GET", "audrey", "feed/foryou", authenticate=True) + return feed diff --git a/jobs/feed/following.py b/jobs/feed/following.py new file mode 100644 index 0000000..8aec0bf --- /dev/null +++ b/jobs/feed/following.py @@ -0,0 +1,9 @@ +def followingfeed(API): + """ + List all of a token's user's feed items from the users they are following. + + Returns: + A list of feed items. + """ + feed = API.make_request("GET", "audrey", "feed/following", authenticate=True) + return feed diff --git a/testing.py b/testing.py index 0de3be7..c30cab5 100644 --- a/testing.py +++ b/testing.py @@ -14,7 +14,7 @@ if not os.getenv("client_id") or not os.getenv("client_secret"): API = APIClient( client_id=os.getenv("client_id"), client_secret=os.getenv("client_secret"), - debug=False + debug=True ) # Keep a token cache to avoid unnecessary sign-ins during development. @@ -98,6 +98,12 @@ if not API.is_token_valid(): # print(post) # x += 1 # print("-----------------------------") -notifications = API.run_job('notification.listnotifications') -print(notifications) +# notifications = API.run_job('notification.listnotifications') +# print(notifications) +# print("-----------------------------") +# feed = API.run_job('feed.cafefeed') +# print(feed) +# print("-----------------------------") +feed = API.run_job('feed.followingfeed') +print(feed) print("-----------------------------") \ No newline at end of file