Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'api' is not defined #35

Open
aktivkohle opened this issue Feb 21, 2017 · 1 comment
Open

NameError: name 'api' is not defined #35

aktivkohle opened this issue Feb 21, 2017 · 1 comment

Comments

@aktivkohle
Copy link

aktivkohle commented Feb 21, 2017

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?

@mikechen66
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants