disqus-python icon indicating copy to clipboard operation
disqus-python copied to clipboard

NameError: name 'api' is not defined

Open aktivkohle opened this issue 8 years ago • 1 comments

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?

aktivkohle avatar Feb 21 '17 15:02 aktivkohle

It might work.

NameError: name 'api' is not defined ou forgot to import api Try with following: from openerp import api,models,fields

https://stackoverflow.com/questions/41363869/nameerror-name-api-is-not-defined/41364578#41364578

mikechen66 avatar Jun 23 '18 15:06 mikechen66