文章詳情頁
python - tweepy 庫 連接Twitter API 報錯
瀏覽:178日期: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. android - 美團篩選處篩選條件停靠+條件點擊滑動到頂部。2. list - python 求助3. python3.x - python3.5使用pyinstaller打包報錯找不到libpython3.5mu.so.1.0等文件求解?4. python算法,如何優雅的合并2個列表字典?5. python - def自定義函數的疑惑6. 請教: 關于 python 反斜杠轉義的疑問7. mysql優化 - mysql like語句會導致全表掃描?8. javascript 如何下載一個excel文件 ?9. Python中, 仿照經典代碼實現單例, 卻出現了不是單例的的狀態, 代碼哪里出錯了 ?10. php由5.3升級到5.6后,登錄網站,返回的是php代碼,不是登錄界面,各位大神有知道的嗎?
排行榜
