2025-04-11 21:46:02 +00:00
|
|
|
from lunduke.client import DiscourseClient
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2025-04-12 17:16:27 +00:00
|
|
|
|
2025-04-12 21:40:53 +00:00
|
|
|
client = DiscourseClient()
|
2025-04-11 21:46:02 +00:00
|
|
|
try:
|
|
|
|
response = client.get('/posts.json')
|
2025-04-12 21:40:53 +00:00
|
|
|
posts = response.json()['latest_posts']
|
2025-04-11 21:46:02 +00:00
|
|
|
print(f"Found {len(posts)} posts")
|
|
|
|
for post in posts:
|
2025-04-12 16:30:44 +00:00
|
|
|
# print(post)
|
|
|
|
print(post['username'], post['topic_title'], post['excerpt'])
|
2025-04-11 21:46:02 +00:00
|
|
|
except Exception as e:
|
|
|
|
print(f"Error: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|