0
私はPythonでrequests
ライブラリを使用してWebサーバー上のデータを照会しています。適切な処理接続エラー:接続が中止されました、BadStatusLine( "'"、)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))
が、私は中止が、接続をテストし、それが中断したところから継続しない私のプログラムをしたいと思います:私は次のエラーを取得します。私はこれをどのようにするべきですか?
私は、関数に次のコードを持っているが、Webサーバに照会し、そのquery_predix_ts
呼ば:
for tag in tags_list:
if tag in tags_with_dim_list:
for dim in dims:
try:
df = query_predix_ts(t1, t2, tag, 0, this_msk, dim)
except(ValueError, NameError) as e:
print e
if df.shape[0] != 0:
sensor_type = tag + dim
df['sensor_type'] = sensor_type
# print df.head()
single_df.append(df)
どのように私は試し-例外内の行をラップする必要があります。
r_s = requests.post(url, data=json.dumps(payload2), headers=header_store)
ここで関数呼び出しがあります接続エラーが発生した場合、試行を続けます。