文章详情页
python - tweepy 库 连接Twitter API 报错
浏览:48日期:2022-06-30 13:15:38
问题描述
环境:python 2.7.10 tweepy:3.5.0错误:tweepy.error.TweepError: Failed to send request: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
代码:网上一个demoimport reimport tweepy
auth = tweepy.OAuthHandler('xxxxx',
'xxxxx')
auth.set_access_token('xxxxx',
'xxxxx')
api = tweepy.API(auth,proxy='127.0.0.1:1080') highpoints = re.compile(u’uD800-uDBFF’) public_tweets = api.home_timeline() num = 0 for tweet in public_tweets:
print num num += 1 text_noem = highpoints.sub(’--emoji--’, tweet.text) text_noem = text_noem.encode(’utf8’)
求大神指点,什么原因呢?
问题解答
回答1:原来是代理服务器不支持http协议,换了代理就可以了
相关文章:
1. mysql - oracle物化视图和临时表的区别是什么?2. 网页爬虫 - Python爬虫返回状态码与实际情况不符?3. paramiko - Python tempfile生成的文件能不能拷贝到远程服务器?4. html标签属性元素讲解5. 怎么可以实现在手机浏览器看到链接的title属性,就是鼠标放上去会有一个tip效果的6. URL访问有问题啊7. MYSQL代码执行错误:FUNCTION any_value does not exist8. node.js - nodejs开发中常用的连接mysql的库9. 微信小程序如何加载h5页面10. python - 能通过CAN控制一部普通的家用轿车吗?
排行榜