我正在开发基于 python 2.7 的 GUI 来阅读推文。
当我通过 Eclipse 和 PyDev 运行脚本时,一切正常。但在使用 gui2exe/py2exe 编译后,我收到以下错误消息:
twython.exceptions.TwythonAuthError: Unable to obtain OAuth 2 access token
代码是:
CONSUMER_KEY = '****'
CONSUMER_SECRET = '****'
ACCESS_KEY = '****'
ACCESS_SECRET = '****'
twitter = Twython(CONSUMER_KEY, CONSUMER_SECRET, oauth_version=2)
ACCESS_TOKEN = twitter.obtain_access_token()
if settings.value("Proxys").toBool() == True:
httpproxy = settings.value ("HttpProxy").toString()
httpsproxy = settings.value ("HttpsProxy").toString()
proxystring = "'http': '%s','https': '%s'" % (httpproxy, httpsproxy)
client_args = {
'proxies': {
proxystring,
}
}
self.api = Twython(CONSUMER_KEY, access_token=ACCESS_TOKEN, client_args=client_args)
else:
self.api = Twython(CONSUMER_KEY, access_token=ACCESS_TOKEN)
任何人都可以帮忙吗?