OAUTH_TOKEN没有定义twitter

时间:2015-02-16 00:48:33

标签: python twitter-oauth

Patricks-MacBook-Pro-2:Autofollow-API patrickahern$ python sample_twitter_codes.py
Traceback (most recent call last):
  File "sample_twitter_codes.py", line 30, in <module>
    from twitter_follow_bot import auto_follow_followers_for_user
  File "/Users/patrickahern/Documents/Vault/Internal-Social/Autofollow-API/twitter_follow_bot.py", line 26, in <module>
    from twitter_info import *
  File "/Users/patrickahern/Documents/Vault/Internal-Social/Autofollow-API/twitter_info.py", line 1, in <module>
    OAUTH_TOKEN = "zzzzzzzzzzzz"-"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
NameError: name 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' is not defined

根据反馈意见,OAUTH_TOKEN的后半部分似乎有些不对劲,但我已多次检查我的Twitter API并且无法发现任何错误。

1 个答案:

答案 0 :(得分:0)

OAUTH_TOKEN = "zzzzzzzzzzzz"-"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  

NameError:name&#39; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#39;未定义

错误在于您对Twitter应用程序生成的访问令牌的上述处理。

正确的格式是:

OAUTH_TOKEN = "zzzzzzzzzzzz-xxxxxxxxxxxxxxxxxx"

即&#34; - &#34;连字符是令牌的一部分,需要包含在字符串中。