質問編集履歴

1

エラー文の修正

2019/06/26 02:46

投稿

comet0310
comet0310

スコア59

test CHANGED
File without changes
test CHANGED
@@ -70,6 +70,120 @@
70
70
 
71
71
 
72
72
 
73
+
74
+
75
+ 386 # otherwise it looks like a programming error was the cause.
76
+
77
+ --> 387 six.raise_from(e, None)
78
+
79
+ 388 except (SocketTimeout, BaseSSLError, SocketError) as e:
80
+
81
+
82
+
83
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py in raise_from(value, from_value)
84
+
85
+
86
+
87
+
88
+
89
+ 382 try:
90
+
91
+ --> 383 httplib_response = conn.getresponse()
92
+
93
+ 384 except Exception as e:
94
+
95
+
96
+
97
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in getresponse(self)
98
+
99
+ 1330 try:
100
+
101
+ -> 1331 response.begin()
102
+
103
+ 1332 except ConnectionError:
104
+
105
+
106
+
107
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in begin(self)
108
+
109
+ 296 while True:
110
+
111
+ --> 297 version, status, reason = self._read_status()
112
+
113
+ 298 if status != CONTINUE:
114
+
115
+
116
+
117
+
118
+
119
+ 265 # sending a valid response.
120
+
121
+ --> 266 raise RemoteDisconnected("Remote end closed connection without"
122
+
123
+ 267 " response")
124
+
125
+
126
+
127
+ RemoteDisconnected: Remote end closed connection without response
128
+
129
+
130
+
131
+ During handling of the above exception, another exception occurred:
132
+
133
+
134
+
135
+ ProtocolError Traceback (most recent call last)
136
+
137
+
138
+
139
+ 439 retries=self.max_retries,
140
+
141
+ --> 440 timeout=timeout
142
+
143
+ 441 )
144
+
145
+
146
+
147
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
148
+
149
+ 638 retries = retries.increment(method, url, error=e, _pool=self,
150
+
151
+ --> 639 _stacktrace=sys.exc_info()[2])
152
+
153
+ 640 retries.sleep()
154
+
155
+
156
+
157
+
158
+
159
+ 356 if read is False or not self._is_method_retryable(method):
160
+
161
+ --> 357 raise six.reraise(type(error), error, _stacktrace)
162
+
163
+ 358 elif read is not None:
164
+
165
+
166
+
167
+
168
+
169
+ 684 if value.__traceback__ is not tb:
170
+
171
+ --> 685 raise value.with_traceback(tb)
172
+
173
+ 686 raise value
174
+
175
+
176
+
177
+
178
+
179
+ 600 body=body, headers=headers,
180
+
181
+ --> 601 chunked=chunked)
182
+
183
+ 602
184
+
185
+
186
+
73
187
  /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
74
188
 
75
189
  386 # otherwise it looks like a programming error was the cause.
@@ -92,8 +206,6 @@
92
206
 
93
207
  384 except Exception as e:
94
208
 
95
-
96
-
97
209
  /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in getresponse(self)
98
210
 
99
211
  1330 try:
@@ -124,7 +236,7 @@
124
236
 
125
237
 
126
238
 
127
- RemoteDisconnected: Remote end closed connection without response
239
+ ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
128
240
 
129
241
 
130
242
 
@@ -132,76 +244,142 @@
132
244
 
133
245
 
134
246
 
135
- ProtocolError Traceback (most recent call last)
247
+ ConnectionError Traceback (most recent call last)
248
+
249
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/base/exchange.py in fetch(self, url, method, headers, body)
250
+
251
+ 422 timeout=int(self.timeout / 1000),
252
+
253
+ --> 423 proxies=self.proxies
254
+
255
+ 424 )
256
+
257
+
258
+
259
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
260
+
261
+ 507 send_kwargs.update(settings)
262
+
263
+ --> 508 resp = self.send(prep, **send_kwargs)
264
+
265
+ 509
266
+
267
+
268
+
269
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
270
+
271
+ 617 # Send the request
272
+
273
+ --> 618 r = adapter.send(request, **kwargs)
274
+
275
+ 619
276
+
277
+
136
278
 
137
279
  /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
138
280
 
139
- 439 retries=self.max_retries,
140
-
141
- --> 440 timeout=timeout
142
-
143
- 441 )
144
-
145
-
146
-
147
- /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
148
-
149
- 638 retries = retries.increment(method, url, error=e, _pool=self,
150
-
151
- --> 639 _stacktrace=sys.exc_info()[2])
152
-
153
- 640 retries.sleep()
154
-
155
-
156
-
157
- /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
158
-
159
- 356 if read is False or not self._is_method_retryable(method):
160
-
161
- --> 357 raise six.reraise(type(error), error, _stacktrace)
162
-
163
- 358 elif read is not None:
164
-
165
-
166
-
167
- /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py in reraise(tp, value, tb)
168
-
169
- 684 if value.__traceback__ is not tb:
170
-
171
- --> 685 raise value.with_traceback(tb)
172
-
173
- 686 raise value
174
-
175
-
176
-
177
- /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
178
-
179
- 600 body=body, headers=headers,
180
-
181
- --> 601 chunked=chunked)
182
-
183
- 602
184
-
185
-
186
-
187
- /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
188
-
189
- 386 # otherwise it looks like a programming error was the cause.
190
-
191
- --> 387 six.raise_from(e, None)
192
-
193
- 388 except (SocketTimeout, BaseSSLError, SocketError) as e:
194
-
195
-
196
-
197
- /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py in raise_from(value, from_value)
198
-
199
-
200
-
201
- /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
202
-
203
- 382 try:
204
-
205
- --> 383 httplib_response = conn.getresponse()
206
-
207
- 384 except Exception as e:
281
+ 489 except (ProtocolError, socket.error) as err:
282
+
283
+ --> 490 raise ConnectionError(err, request=request)
284
+
285
+ 491
286
+
287
+
288
+
289
+ ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
290
+
291
+
292
+
293
+ During handling of the above exception, another exception occurred:
294
+
295
+
296
+
297
+ NetworkError Traceback (most recent call last)
298
+
299
+ <ipython-input-360-b459938ea1de> in <module>()
300
+
301
+ 22 mex_ticker=mex.fetch_ticker(symbol='BTC/USD')
302
+
303
+ ---> 23 fly_ticker=fly.fetch_ticker(symbol='BTC/JPY')
304
+
305
+ 24 except NetworkError:
306
+
307
+
308
+
309
+
310
+
311
+ 167 'product_code': self.market_id(symbol),
312
+
313
+ --> 168 }, params))
314
+
315
+ 169 timestamp = self.parse8601(ticker['timestamp'])
316
+
317
+
318
+
319
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/base/exchange.py in request(self, path, api, method, params, headers, body)
320
+
321
+ 361 def request(self, path, api='public', method='GET', params={}, headers=None, body=None):
322
+
323
+ --> 362 return self.fetch2(path, api, method, params, headers, body)
324
+
325
+ 363
326
+
327
+
328
+
329
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/base/exchange.py in fetch2(self, path, api, method, params, headers, body)
330
+
331
+ 358 request = self.sign(path, api, method, params, headers, body)
332
+
333
+ --> 359 return self.fetch(request['url'], request['method'], request['headers'], request['body'])
334
+
335
+ 360
336
+
337
+
338
+
339
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/base/exchange.py in fetch(self, url, method, headers, body)
340
+
341
+ 452 if ('ECONNRESET' in error_string) or ('Connection aborted.' in error_string):
342
+
343
+ --> 453 self.raise_error(NetworkError, url, method, e)
344
+
345
+ 454 else:
346
+
347
+
348
+
349
+ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ccxt/base/exchange.py in raise_error(self, exception_type, url, method, error, details)
350
+
351
+ 343 output = ' '.join([self.id] + [var for var in (url, method, error, details) if var is not None])
352
+
353
+ --> 344 raise exception_type(output)
354
+
355
+ 345
356
+
357
+
358
+
359
+ NetworkError: bitflyer https://api.bitflyer.jp/v1/getticker?product_code=BTC_JPY GET ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
360
+
361
+
362
+
363
+ During handling of the above exception, another exception occurred:
364
+
365
+
366
+
367
+ NameError Traceback (most recent call last)
368
+
369
+ <ipython-input-360-b459938ea1de> in <module>()
370
+
371
+ 22 mex_ticker=mex.fetch_ticker(symbol='BTC/USD')
372
+
373
+ 23 fly_ticker=fly.fetch_ticker(symbol='BTC/JPY')
374
+
375
+ ---> 24 except NetworkError:
376
+
377
+ 25 time.sleep(3)
378
+
379
+ 26 traceback.print_exc()
380
+
381
+
382
+
383
+ NameError: name 'NetworkError' is not defined
384
+
385
+ ```