Package: pydiscourse
A Python library for working with Discourse.This is a fork of the original Tindie version. It was forked to include fixes,
additional functionality, and to distribute a package on PyPI.GoalsExceptional documentationSupport all supported Python versionsProvide functional parity with the Discourse API, for the currently supported
version of Discourse (something of a moving target)The order here is important. The Discourse API is itself poorly documented so
the level of documentation in the Python client is critical.Installationpip install pydiscourseExamplesCreate a client connection to a Discourse server:from pydiscourse import DiscourseClient
client = DiscourseClient(
        'http://example.com',
        api_username='username',
        api_key='areallylongstringfromdiscourse')Get info about a user:user = client.user('eviltrout')
print user

user_topics = client.topics_by('johnsmith')
print user_topicsCreate a new user:user = client.create_user('The Black Knight', 'blacknight', 'knight@python.org', 'justafleshwound')Implement SSO for Discourse with your Python server:@login_required
def discourse_sso_view(request):
    payload = request.GET.get('sso')
    signature = request.GET.get('sig')
    nonce = sso_validate(payload, signature, SECRET)
    url = sso_redirect_url(nonce, SECRET, request.user.email, request.user.id, request.user.username)
    return redirect('http://discuss.example.com' + url)Command lineTo help experiment with the Discourse API, pydiscourse provides a simple command line client:export DISCOURSE_API_KEY=your_master_key
pydiscoursecli --host-http://yourhost --api-user-system latest_topics
pydiscoursecli --host-http://yourhost --api-user-system topics_by johnsmith
pydiscoursecli --host-http://yourhost --api-user-system user eviltroutRelease history1.6.1Addsposts_by_numberendpoint from @Dettorer1.6.0Breaking:toggle_gravatar,pick_avatar,create_groupnowrequirekeyword arguments where keyword arguments were used. Thismaybreak existing
code if you have not referenced these by keyword!Introducedruffandblackinto pre-commit hookAddedlintjob to GitHub Actions, tests will run if and only if lint job
passes.Sundry code cleanup1.5.0Owner creation endpoint update from @akhmerovPython 3.11 support from @DettorerGroup membership fixes from @inducerRate limiting fixes from @inducerLatest posts endpoint from @max-lancaster1.4.0Documented here as skipped release1.3.0Add fix for handling global Discourse timeoutsAdd group ownersUpdate API for add_group_owner1.2.0BREAKING? Dropped support for Python 2.7, 3.4, 3.5Added numerous new endpoint queriesUpdated category querying1.1.2Fix for Discourse users API change1.1.1Fix for empty dictionary and 413 API responseFix for getting member groups1.1.0Added ability to follow redirects in requests1.0.0Authenticate with headers0.9.0Added rate limiting supportAdded some support for user activation0.8.0Add some PR guidanceAdd support for files in the core request methodsAdds numerous new API controls, including:tag_groupuser_actionsupload_imageblocktrust_level_lockcreate_site_customization (theme)create_color_schemecolor_schemesadd_group_membersgroup_membersgroup_ownersdelete_groupcreate_groupgroupcustomize_site_textsdelete_categoryuser_emailsupdate_topic_statuscreate_postupdate_topicupdate_avataruser_all0.7.0Place request parameters in the request body for POST and PUT requests.
Allows larger request sizes and solves forURI Too Largeerror.0.6.0Adds method to add user to group by user ID0.5.0Adds badges functionality0.4.0Adds initial groups functionality0.3.2SSO functionality fixes0.3.1Fix how empty responses are handled0.3.0Added method to unsuspend suspended user0.2.0Inital fork, including gberaudo’s changesPackaging cleanup, dropping Python 2.6 support and adding Python 3.5, PyPy,
PyPy3Packaging on PyPI0.1.0.devAll pre-PyPI development