Disqus API bindings for Python

Overview

disqus-python

https://travis-ci.org/disqus/disqus-python.svg?branch=master

Let's start with installing the API:

pip install disqus-python

Use the API by instantiating it, and then calling the method through dotted notation chaining:

from disqusapi import DisqusAPI
disqus = DisqusAPI(secret_key, public_key)
for result in disqus.get('trends.listThreads'):
    print result

Parameters (including the ability to override version, api_secret, and format) are passed as keyword arguments to the resource call:

disqus.get('posts.details', post=1, version='3.0')

Paginating through endpoints is easy as well:

from disqusapi import Paginator
paginator = Paginator(api.get, 'trends.listThreads', forum='disqus')
for result in paginator:
    print result

# pull in a maximum of 500 results (this limit param differs from the endpoint's limit param)
for result in paginator(limit=500):
    print result

Documentation on all methods, as well as general API usage can be found at https://disqus.com/api/docs/

Issues
  • Now compatible from Python 2.6-3.4 with all unit tests passing.

    Now compatible from Python 2.6-3.4 with all unit tests passing.

    Hi I've refactored most of the incompatibility issues, and package runs on Python 2.6, 2.7, 3.3, and 3.4. Here are some changes i've made.

    Build Status

    Changelog

    • Added Travis-CI Integration
    • General Bug/Compatibility Fixes
      • +# -*- coding: utf-8 -*- and from __future__ import idioms
    • Supports wheel binary specification
    • Removed depreciated modules e.g. pkg_resources
    • Cleanup of __init__.py
    • Added requirements.txt & test_requirements.txt
    • Added Makefile for automation
    • Created __version__.py as single authoritative reference of version #

    Some additional refactoring that would be useful

    TODO:

    • Documentation, maybe just pulling the docstrings with Sphinx Autofunc
    • Moving rest of code out of __init__.py
    • Complete refactor of setup.py
    • Authentication without secret key, or some cryptography.
    • A CONTRIBUTE.in file
    • Remove simplejson dependency
    opened by jjangsangy 8
  • Python 3 support

    Python 3 support

    Considering the Python maintainers say that Python 3 is the "current and future version," and Python 2 is "legacy," it seems to make sense to port disqus-python to Python 3. As stands, it's unusable in a Python 3 environment, and a tool like auto2to3 fails with an ImportError (no module named 'disqus_static').

    For starters, in Python 3, httplib was changed to http.client (see also: http://stackoverflow.com/questions/13778252/import-httplib-importerror-no-module-named-httplib).

    opened by ShaunaGordon 8
  • Package httplib not found!

    Package httplib not found!

    I tried to install & run the first lines of code. Got the ImportError: No module named 'httplib' for lines in __init__.py of disqusapi. When searched online, found that there is no httplib anymore. There is a newer package called httplib2 and httplib has been renamed to http.client in Python 3 [email protected]. Should the code be updated to reflect the changes?

    opened by rampyg 5
  • Invalid API Key due to missing Content-Type

    Invalid API Key due to missing Content-Type

    A couple of hours ago, my calls to the Disqus API started to fail due to Invalid API key. Interestingly, I couldn't reproduce this with cURL or the requests library. So I had a closer look at the requests and noticed that the client does not specify the Content-Type header. Setting it to application/x-www-form-urlencoded resolves the issue. I guess something in the backend has changed lately (e.g., the default content type).

    I'm not sure whether or not this project is still maintained. The fix is trivial but if a pull request is preferred, I will gladly submit one.

    opened by jvcop 3
  • Better handling for when an interface is not defined.

    Better handling for when an interface is not defined.

    Moved the https call out for easier use with mock. Removed pytest dependancy.

    opened by dpetzold 3
  • TypeError: __call__() takes exactly 1 argument (2 given)

    TypeError: __call__() takes exactly 1 argument (2 given)

    Using pip install disqus-python I got version 0.4.2 installed.

    The following code raises error (in fact it is just like in your example):

    from disqusapi import DisqusAPI
    public_key = 'XXXXXXXXXXXXXXXXXXXX'
    secret_key = 'XXXXXXXXXXXXXXXXXXXX'
    disqus = DisqusAPI(secret_key, public_key)
    disqus.get('threads.listPopular', forum='myforum')
    

    If I pass values as in the following code I get error JSONDecodeError: Expecting value: line 1 column 1 (char 0):

    kwargs = {
        'method': 'threads.listPopular',
        'forum': 'myforum',
    }
    disqus.get(**kwargs)
    
    opened by shalakhin 3
  • Python 3.3 compatibility

    Python 3.3 compatibility

    • Refactor needed in order to have tests
    • 100% Coverage with unit tests
    • Syntax highlight in README.rst
    • Update CHANGES
    • Added tox and nose configuration
    • Ignore .coverage, .tox and *.swp

    Can this be a good base for version 0.5?

    opened by graffic 2
  • disqus.get('trends.listThreads'): TypeError: __call__() takes exactly 1 argument (2 given)

    disqus.get('trends.listThreads'): TypeError: __call__() takes exactly 1 argument (2 given)

    I installed disqus-python and followed https://github.com/disqus/disqus-python to do the following but it throws an exception:

    from disqusapi import DisqusAPI disqus = DisqusAPI(secret_key, public_key) for result in disqus.get('trends.listThreads'): print result

    disqus.get('trends.listThreads') Traceback (most recent call last): File "", line 1, in TypeError: call() takes exactly 1 argument (2 given)

    opened by chicheongweng 2
  • Invalid API key Error

    Invalid API key Error

    I had tested the code sample in README, and it returns Invalid API key Error.

    What does it mean? Did I inject incorrect secret key or disqus.trends.listThread() is not recognizable?

    opened by psalty 1
  • minimal python3 compatability

    minimal python3 compatability

    Updated pull request for minimum compatibility with Python 3.

    All unit tests passing for Python versions 2.6, 2.7, 3.3 and 3.4 confirmed on TravisCI. I can remove the .travis.yml file if CI testing isn't necessary.

    I also have a Pelican blog using the API, and tested that it runs correctly.

    Changelog

    • Uses six module for main compatibility layer with Python 2 and Python 3. Added it to the requirement specification.
    • All iterators and moved standard library modules changed to use six module versions.
    • Added requirements.txt and test_requirements.txt files.
    opened by jjangsangy 1
  • Is this library dead then?

    Is this library dead then?

    opened by coler-j 0
  • Add access_token support

    Add access_token support

    Add support for requests with access tokens.

    opened by drewjaja 0
  • NameError: name 'api' is not defined

    NameError: name 'api' is not defined

    So I'm trying to navigate around the functionality of this library and find the things I need but nothing seems to work at first try unfortunately.

    I got the first example from README.rst to work in Python 3 with a few modifications but the third piece of code (with brackets for the print for python 3) is throwing the error in the title

    from disqusapi import Paginator
    paginator = Paginator(api.get, 'trends.listThreads', forum='disqus')
    for result in paginator:
        print (result)
    

    So I tried to change api.get to disqus as defined above disqus = DisqusAPI(secret_key, public_key) but now it is throwing a different error InterfaceNotDefined: Interface is not defined, you must pass ``method`` (HTTP Method). I tried the solution that worked for the other code snippet: paginator = Paginator(disqus, 'trends.listThreads', forum='disqus', method='GET') ..now it's running without error but not returning anything.

    Does anyone know how this code is meant to work?

    opened by aktivkohle 1
  • cannot import disqusapi with python3

    cannot import disqusapi with python3

    After I started ipython3, and typed in the shell import disqusapi, it showed ImportError: No module named 'httplib'. Seems look like the disqusapi isn't supporting python3?

    I'm using Python 3.5.2 :: Anaconda custom (x86_64)

    Here's the error log:

    In [1]: import disqusapi
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-2-1dede7c1a4ae> in <module>()
    ----> 1 import disqusapi
    
    /Users/kspun/anaconda3/lib/python3.5/site-packages/disqusapi/__init__.py in <module>()
         13     __version__ = 'unknown'
         14 
    ---> 15 import httplib
         16 import os.path
         17 import simplejson
    
    ImportError: No module named 'httplib'
    
    opened by carsonpun 2
  • NameError: name 'Paginator' is not defined

    NameError: name 'Paginator' is not defined

    This example code

    paginator = Paginator(api.get, 'trends.listThreads', forum='disqus')
    for result in paginator:
        print result
    

    throws the error mentioned in the title.

    Probably a little bit of update in the README file would help, I am sure it is outdated, as I have seen in another issue thread.

    opened by imrek 3
  • Update setup.py

    Update setup.py

    update your setup.py to 0.5.0 and update https://pypi.python.org/pypi/disqus-python/0.4.2 please

    opened by bhcopeland 0
  • update pypi listing, has 0.4.2 and should be 0.5.0

    update pypi listing, has 0.4.2 and should be 0.5.0

    uses httplib ..

    https://github.com/disqus/disqus-python/blob/master/CHANGES

    Edit:

    Oh, "support for python 3"

    Can you guys updates pypi then please, its still running older (non python3) version.

    https://pypi.python.org/pypi/disqus-python/0.4.2

    opened by bhcopeland 0
  • Release 0.5.0 on pypi

    Release 0.5.0 on pypi

    Hey there :)

    I'm curious. Do you happen to know when the next version (0.5.0 as the https://github.com/disqus/disqus-python/blob/master/CHANGES states) will be released? I'd like to use this package but I do not want to introduce the simplejson dependency.

    Thank you in advance and best regards.

    opened by lukasender 2
  • Bug with first lines of code in documentation?

    Bug with first lines of code in documentation?

    I installed disqus-python then tried the basic example with my secret key and public key:

    pip install disqus-python
    from disqusapi import DisqusAPI
    disqus = DisqusAPI(secret_key, public_key)
    

    However now when I do

    disqus.get('trends.listThreads')
    

    I get the error:

    TypeError: __call__() takes exactly 1 argument (2 given)
    
    opened by lee-hodg 9
  • Add some missing interfaces; alter handling of missing `public_key`

    Add some missing interfaces; alter handling of missing `public_key`

    Add three endpoints missing from interfaces.json added (posts.update, forums.addModerator and forums.removeModerator);

    Somewhat cosmetic change: Some API calls (notably posts.create with certain args like ip_address) will not work as expected if both public_key and secret_key are passed, so alter the check in disqusapi.DisqusAPI.__init__() so that it doesn't complain when only secret key is provided.

    opened by strix-technica 2
Python bindings for Alexa Web Information Service (AWIS) API

Attention! This package is no longer maintained. See this ticket for more info. Wraps Alexa Web Information Service. Usage Making UrlInfo requests: ap

Atamert Ölçgen 50 Aug 11, 2020
Python bindings for swm-core client REST API

Python bindings for swm-core client REST API Description Sky Port is an universal bus between user software and compute resources. It can also be cons

Sky Workflows 1 Jan 1, 2022
Python bindings for ArrayFire: A general purpose GPU library.

ArrayFire Python Bindings ArrayFire is a high performance library for parallel computing with an easy-to-use API. It enables users to write scientific

ArrayFire 383 Dec 17, 2021
Python bindings for BigML.io

BigML Python Bindings BigML makes machine learning easy by taking care of the details required to add data-driven decisions and predictive power to yo

BigML Inc, Machine Learning made easy 265 Jan 9, 2022
Python bindings to the Syncthing REST interface.

python-syncthing Python bindings to the Syncthing REST interface. Python API Documentation Syncthing Syncthing REST Documentation Syncthing Forums $ p

Blake VandeMerwe 58 Jan 7, 2022
Python bindings for LibreTranslate

Python bindings for LibreTranslate

Argos Open Tech 17 Jan 13, 2022
pylunasvg - Python bindings for lunasvg

pylunasvg - Python bindings for lunasvg Pylunasvg is a simple wrapper around lunasvg that uses pybind11 to create python bindings. All public API of t

Eren 3 Dec 7, 2021
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 2.7k Jan 11, 2022
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 2.7k Jan 14, 2022
alpaca-trade-api-python is a python library for the Alpaca Commission Free Trading API.

alpaca-trade-api-python is a python library for the Alpaca Commission Free Trading API. It allows rapid trading algo development easily, with support for both REST and streaming data interfaces

Alpaca 1.2k Jan 15, 2022
WhatsApp Api Python - This documentation aims to exemplify the use of Moorse Whatsapp API in Python

WhatsApp API Python ChatBot Este repositório contém uma aplicação que se utiliza

Moorse.io 3 Jan 8, 2022
Official python API for Phish.AI public and private API to detect zero-day phishing websites

phish-ai-api Summary Official python API for Phish.AI public and private API to detect zero-day phishing websites How it Works (TLDR) Essentially we h

Phish.AI 166 Dec 29, 2021
Python API wrapper around Trello's API

A wrapper around the Trello API written in Python. Each Trello object is represented by a corresponding Python object. The attributes of these objects

Richard Kolkovich 870 Jan 3, 2022
A python to scratch API connector. Can fetch data from the API and send it back in cloud variables.

Scratch2py Scratch2py or S2py is a easy to use, versatile tool to communicate with the Scratch API Based of scratchclient by Raihan142857 Installation

null 14 Jan 15, 2022
Async ready API wrapper for Revolt API written in Python.

Mutiny Async ready API wrapper for Revolt API written in Python. Installation Python 3.9 or higher is required To install the library, you can just ru

null 17 Jan 6, 2022
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase ?? Links |Join the discord

Pincer 96 Jan 12, 2022
wyscoutapi is an extremely basic API client for the Wyscout API (v2 & v3) for Python

wyscoutapi wyscoutapi is an extremely basic API client for the Wyscout API (v2 & v3). Usage Install with pip install wyscoutapi. To connect to the Wys

Ben Torvaney 7 Dec 19, 2021
Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Harun Mbaabu Mwenda 45 Nov 18, 2021
A Python API wrapper for the Twitter API!

PyTweet PyTweet is an api wrapper made for twitter using twitter's api version 2! Installation Windows py3 -m pip install PyTweet Linux python -m pip

TheFarGG 12 Jan 9, 2022