lunduke-cli/examples/get_latest.py

22 lines
497 B
Python
Raw Permalink Normal View History

2025-04-12 22:56:34 +00:00
from lunduke.client import DiscourseClient
def main():
client = DiscourseClient()
params = {
'order': 'created',
'ascending': 'false'
}
try:
response = client.get('/latest.json', params=params)
topics = response.json()['topic_list']['topics']
print(f"Found {len(topics)} topics")
for topic in topics:
print(topic['title'])
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()