Skip to main content

Discourse API wrapper for Twisted

Project description

Discourse API wrapper written for Twisted (https://twistedmatrix.com/trac/), the event-driven network programming framework written in Python.

Installation:

pip install txDiscourse

Requirements:

  • Twisted > 14.0.0

  • treq==0.2.1

For development/testing: - nosetests == 1.3.4

Usage:

Create a new client and give it your discourse host, api key and username (https://meta.discourse.org/t/using-discourse-api/17587):

from txDiscoure import DiscourseClient

client = DiscourseClient(host, api_key, username)

Create a new topic:

client.create_topic('title', 'text text text')

Get all topics created:

client.topic_by('username')

returns a list of topics in a json string.

For more examples check out the test_api_calls.

Testing:

At the moment tests only cover topics. To run tests:

export DC_HOST="test.discourse.com"
export DC_API_KEY="1234567890"
export DC_USERNAME="system"
nosetest txDiscourse.test_api_calls

License

Copyright 2014 Anouk Ruhaak

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

txDiscourse-0.1.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page