lunduke-cli/examples/draft_post.py

22 lines
560 B
Python
Raw Normal View History

2025-04-12 16:30:44 +00:00
from lunduke.client import DiscourseClient
def main():
client = DiscourseClient()
2025-04-12 22:56:34 +00:00
# https://docs.discourse.org/#tag/Topics/operation/createTopicPostPM
# TODO: FAILS. 403. Forbidden for url: https://forum.lunduke.com/posts.json
2025-04-12 16:30:44 +00:00
try:
draft_data = {
2025-04-12 22:56:34 +00:00
"raw": "This is only a test",
}
2025-04-12 16:30:44 +00:00
response = client.post('/posts.json', data=draft_data)
print(f"Draft created successfully: {response}")
except Exception as e:
print(f"Error creating draft: {e}")
if __name__ == "__main__":
main()