Skip to content

A simple tool to automate the process of creating topics and posts on a Discourse forum. This script mimics the creation of new discussions and replies on a Discourse forum, using fake data for testing or demonstration purposes. It is perfect for developers and administrators who need to populate their Discourse forum with example content quickly.

Notifications You must be signed in to change notification settings

deepakkumar9523/discourse-create-topics-and-posts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discourse Topic Creation Script

This Python script allows you to create topics on a Discourse forum using the Discourse API. It can handle both single and multiple topics, with support for custom formatting, image embedding, and category assignment.

Requirements

  • Python 3.x
  • requests library
  • python-dotenv library
  • tqdm library (for progress tracking)

Setup

  1. Clone the repository or download the script.

  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Create a .env file in the root directory with the following content:

    DISCOURSE_URL=https://your-discourse-site.com
    API_KEY=your-api-key-here
    API_USERNAME=your-username-here

Usage

  1. Prepare a topic.json (single topic) or topics.json (multiple topics) file.

  2. Run the script:

    python create_discourse_topics.py

The script will load topics from the provided JSON file, create them on your Discourse site, and log the results.

Features

  • Supports creating a single topic or multiple topics.
  • Handles markdown formatting, image embedding, and external URLs.
  • Configurable retry limit and rate-limiting delay for API calls.

Logging

Logs are saved to discourse_topics.log and will also be printed to the console.


About

A simple tool to automate the process of creating topics and posts on a Discourse forum. This script mimics the creation of new discussions and replies on a Discourse forum, using fake data for testing or demonstration purposes. It is perfect for developers and administrators who need to populate their Discourse forum with example content quickly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages