lunduke-cli/examples/draft_post.py

22 lines
560 B
Python

from lunduke.client import DiscourseClient
def main():
client = DiscourseClient()
# https://docs.discourse.org/#tag/Topics/operation/createTopicPostPM
# TODO: FAILS. 403. Forbidden for url: https://forum.lunduke.com/posts.json
try:
draft_data = {
"raw": "This is only a test",
}
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()