2025-04-12 16:30:44 +00:00
|
|
|
from lunduke.client import DiscourseClient
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2025-04-12 21:40:53 +00:00
|
|
|
client = DiscourseClient()
|
2025-04-12 22:56:34 +00:00
|
|
|
|
2025-04-13 11:07:45 +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()
|