27 lines
869 B
Python
27 lines
869 B
Python
class DiscourseConfig:
|
|
"""Configuration settings for the Discourse API client."""
|
|
|
|
def __init__(self, host, username=None, config_file=None):
|
|
"""
|
|
Initialize configuration with host and optional username.
|
|
|
|
Args:
|
|
host: The Discourse forum host (e.g., 'forum.lunduke.com')
|
|
username: The API username
|
|
config_file: Optional path to a config file
|
|
"""
|
|
self.host = host
|
|
self.username = username
|
|
self.api_url = f"https://{host}"
|
|
|
|
if config_file:
|
|
self._load_from_file(config_file)
|
|
|
|
def _load_from_file(self, config_file):
|
|
"""Load configuration from a file (JSON/YAML)."""
|
|
# Implementation for loading config from file
|
|
pass
|
|
|
|
def get_base_url(self):
|
|
"""Return the base URL for API requests."""
|
|
return self.api_url |