Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8304e7b2f5 | |||
| 5806beef34 | |||
| f905a957f4 | |||
| 06ca2c5a58 | |||
| bde4325776 | |||
| 6b7e570475 | |||
| 3659724f11 | |||
| 1e151fc51f | |||
| 63f120ddca |
@@ -1,2 +1,6 @@
|
||||
(Based on original authors list and may be incomplete)
|
||||
|
||||
Marc Sibson
|
||||
James Potter
|
||||
Ben Lopatin
|
||||
Daniel Zohar
|
||||
|
||||
+13
-7
@@ -1,19 +1,25 @@
|
||||
=========
|
||||
Changelog
|
||||
=========
|
||||
.. :changelog:
|
||||
|
||||
Release history
|
||||
===============
|
||||
|
||||
0.3.2
|
||||
-----
|
||||
|
||||
* SSO functionality fixes
|
||||
|
||||
0.3.1
|
||||
=====
|
||||
-----
|
||||
|
||||
* Fix how empty responses are handled
|
||||
|
||||
0.3.0
|
||||
=====
|
||||
-----
|
||||
|
||||
* Added method to unsuspend suspended user
|
||||
|
||||
0.2.0
|
||||
=====
|
||||
-----
|
||||
|
||||
* Inital fork, including gberaudo's changes
|
||||
* Packaging cleanup, dropping Python 2.6 support and adding Python 3.5, PyPy,
|
||||
@@ -21,7 +27,7 @@ Changelog
|
||||
* Packaging on PyPI
|
||||
|
||||
0.1.0.dev
|
||||
=========
|
||||
---------
|
||||
|
||||
All pre-PyPI development
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
include setup.py
|
||||
include README.rst
|
||||
include MANIFEST.in
|
||||
include HISTORY.rst
|
||||
include LICENSE
|
||||
recursive-include pydiscourse
|
||||
@@ -46,9 +46,14 @@ dist: clean ## Creates new source and wheel distributions (cleans first)
|
||||
python setup.py bdist_wheel
|
||||
ls -l dist
|
||||
|
||||
docs: ## Builds and open docs
|
||||
api-docs: ## Build autodocs from docstrings
|
||||
sphinx-apidoc -f -o docs pydiscourse
|
||||
|
||||
manual-docs: ## Build written docs
|
||||
$(MAKE) -C docs clean
|
||||
$(MAKE) -C docs html
|
||||
|
||||
docs: api-docs manual-docs ## Builds and open docs
|
||||
open docs/_build/html/index.html
|
||||
|
||||
help:
|
||||
|
||||
+12
-2
@@ -14,10 +14,20 @@ additional functionality, and to distribute a package on PyPI.
|
||||
Goals
|
||||
=====
|
||||
|
||||
* Exceptional documentation
|
||||
* Support all supported Python versions
|
||||
* Provide functional parity with the Discourse API, for the currently supported
|
||||
version of Discourse (something of a moving target)
|
||||
* Support all supported Python versions
|
||||
* Document API
|
||||
|
||||
The order here is important. The Discourse API is itself poorly documented so
|
||||
the level of documentation in the Python client is critical.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
::
|
||||
|
||||
pip install pydiscourse
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
+2
-4
@@ -28,9 +28,7 @@ import os
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
]
|
||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon']
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
@@ -55,7 +53,7 @@ copyright = u'2014, Marc Sibson'
|
||||
# The short X.Y version.
|
||||
version = '0.3'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.3.1'
|
||||
release = '0.3.2'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
pydiscourse
|
||||
===========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
pydiscourse
|
||||
@@ -0,0 +1,46 @@
|
||||
pydiscourse package
|
||||
===================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
pydiscourse.client module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: pydiscourse.client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pydiscourse.exceptions module
|
||||
-----------------------------
|
||||
|
||||
.. automodule:: pydiscourse.exceptions
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pydiscourse.main module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: pydiscourse.main
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pydiscourse.sso module
|
||||
----------------------
|
||||
|
||||
.. automodule:: pydiscourse.sso
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: pydiscourse
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__version__ = '0.3.1'
|
||||
__version__ = '0.3.2'
|
||||
|
||||
from pydiscourse.client import DiscourseClient
|
||||
|
||||
+5
-4
@@ -27,9 +27,10 @@ import hmac
|
||||
import hashlib
|
||||
|
||||
try: # py3
|
||||
from urllib.parse import unquote, urlencode
|
||||
from urllib.parse import unquote, urlencode, parse_qs
|
||||
except ImportError:
|
||||
from urllib import unquote, urlencode
|
||||
from urlparse import parse_qs
|
||||
|
||||
|
||||
from pydiscourse.exceptions import DiscourseError
|
||||
@@ -63,9 +64,9 @@ def sso_validate(payload, signature, secret):
|
||||
if this_signature != signature:
|
||||
raise DiscourseError('Payload does not match signature.')
|
||||
|
||||
nonce = decoded.split('=')[1]
|
||||
|
||||
return nonce
|
||||
# Discourse returns querystring encoded value. We only need `nonce`
|
||||
qs = parse_qs(decoded)
|
||||
return qs['nonce'][0]
|
||||
|
||||
|
||||
def sso_payload(secret, **kwargs):
|
||||
|
||||
@@ -2,21 +2,31 @@ from setuptools import setup, find_packages
|
||||
|
||||
|
||||
README = open('README.rst').read()
|
||||
VERSION = __import__("pydiscourse").__version__
|
||||
HISTORY = open('HISTORY.rst').read().replace('.. :changelog:', '')
|
||||
|
||||
with open("pydiscourse/__init__.py", "r") as module_file:
|
||||
for line in module_file:
|
||||
if line.startswith("__version__"):
|
||||
version_string = line.split("=")[1]
|
||||
VERSION = version_string.strip().replace("'", "")
|
||||
|
||||
|
||||
setup(
|
||||
name="pydiscourse",
|
||||
version=VERSION,
|
||||
description="A Python library for the Discourse API",
|
||||
long_description=README,
|
||||
long_description=README + '\n\n' + HISTORY,
|
||||
author="Marc Sibson and contributors",
|
||||
author_email="ben+pydiscourse@benlopatin.com",
|
||||
license="BSD",
|
||||
url="https://github.com/bennylope/pydiscourse",
|
||||
packages=find_packages(exclude=["tests.*", "tests"]),
|
||||
install_requires=['requests>=2.0.0'],
|
||||
tests_require=['mock'],
|
||||
install_requires=[
|
||||
'requests>=2.0.0',
|
||||
],
|
||||
tests_require=[
|
||||
'mock',
|
||||
],
|
||||
test_suite='tests',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
import unittest
|
||||
import mock
|
||||
import requests
|
||||
|
||||
from pydiscourse import client
|
||||
|
||||
|
||||
Reference in New Issue
Block a user