やりたいこと
ツイッターでキーワード検索をして,ツイートを取得したい.
15分に一回プログラムを実行する.
実装方法
Whileで無限ループをし,Timeライブラリのsleep()を使って15分スリープさせています.
エラー
python
1Traceback (most recent call last): 2 File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 600, in urlopen 3 chunked=chunked) 4 File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 384, in _make_request 5 six.raise_from(e, None) 6 File “<string>“, line 2, in raise_from 7 File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 380, in _make_request 8 httplib_response = conn.getresponse() 9 File “/usr/local/lib/python3.6/http/client.py”, line 1331, in getresponse 10 response.begin() 11 File “/usr/local/lib/python3.6/http/client.py”, line 297, in begin 12 version, status, reason = self._read_status() 13 File “/usr/local/lib/python3.6/http/client.py”, line 266, in _read_status 14 raise RemoteDisconnected(“Remote end closed connection without” 15http.client.RemoteDisconnected: Remote end closed connection without response 16 17During handling of the above exception, another exception occurred: 18 19Traceback (most recent call last): 20 File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 449, in send 21 timeout=timeout 22 File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 638, in urlopen 23 _stacktrace=sys.exc_info()[2]) 24 File “/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py”, line 367, in increment 25 raise six.reraise(type(error), error, _stacktrace) 26 File “/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py”, line 685, in reraise 27 raise value.with_traceback(tb) 28 File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 600, in urlopen 29 chunked=chunked) 30 File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 384, in _make_request 31 six.raise_from(e, None) 32 File “<string>“, line 2, in raise_from 33 File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 380, in _make_request 34 httplib_response = conn.getresponse() 35 File “/usr/local/lib/python3.6/http/client.py”, line 1331, in getresponse 36 response.begin() 37 File “/usr/local/lib/python3.6/http/client.py”, line 297, in begin 38 version, status, reason = self._read_status() 39 File “/usr/local/lib/python3.6/http/client.py”, line 266, in _read_status 40 raise RemoteDisconnected(“Remote end closed connection without” 41urllib3.exceptions.ProtocolError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’,)) 42 43During handling of the above exception, another exception occurred: 44 45Traceback (most recent call last): 46 File “collect_tweet.py”, line 212, in <module> 47 df, max_id, last_id = get_tweet_with_keyword(df,keyword,count,max_id,last_id) 48 File “collect_tweet.py”, line 40, in get_tweet_with_keyword 49 req = twitter.get(url, params = params)
このようなエラーが出てしまいます.collect_tweet.py
がプログラムのファイル名です.
どうやって解決すれば良いでしょうか?
よろしくおねがいします.
あなたの回答
tips
プレビュー