He estado tratando de escribir una simple mención grabber para comenzar a utilizar Twitter Api. Sin embargo, he estado experimentando algunas dificultades al inicializar el Api. Ejecutando python2 en archlinux Instalé twitter a través de easy_install, lo construí desde la fuente y lo instalé a través de pip. Nada de esto parece estar funcionando.api = twitter.Api() AttributeError: el objeto 'module' no tiene ningún atributo 'Api
zergling :: ~/dev/kritter » python2
Python 2.7.2 (default, Jan 31 2012, 13:26:35)
[GCC 4.6.2 20120120 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import twitter
>>> api = twitter.Api()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Api'
Howdoever the pydoc for twitter está allí. No tengo idea de lo que estoy haciendo mal. Espero que puedan ayudar a
ACTUALIZACIÓN: He intentado utilizar twitter.api()
en lugar de twitter.Api()
y obtuve el siguiente error: Rastreo (llamada más reciente pasado): Archivo "main.py", línea 8, en api = twitter.api() TypeError: 'módulo' objeto no se puede llamar
Informaciones adicionales:
>>> print dir(twitter)
['NoAuth', 'OAuth', 'Twitter', 'TwitterError', 'TwitterHTTPError', 'TwitterResponse', 'TwitterStream', 'UserPassAuth', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'api', 'auth', 'oauth', 'read_token_file', 'stream', 'twitter_globals', 'write_token_file']
>>> print twitter.__path__
['/usr/lib/python2.7/site-packages/twitter-1.7.2-py2.7.egg/twitter']
intente "imprimir dir (twitter)" e "imprimir twitter .__ path__", puede ver cuáles son los métodos disponibles del módulo y dónde se encuentra (para asegurarse de que está utilizando el correcto) – tito
@tito : obtuve lo siguiente de esto. usando twitter.api() obtengo otro error beeing: 'api = twitter.api(); TypeError: el objeto 'module' no se puede llamar' – Momo
Bueno, ves que no hay Api o api class/func en el directorio() – tito