0
を無視これが私のコードです:Pythonの:requests.getが最後のレコード
response = requests.get(apiurl+'api/v1/watch/services',
auth=(apiuser,apipass), verify=False, stream=True)
for line in response.iter_lines():
try:
data = json.loads(line.decode('utf-8'))
pprint.pprint(data)
except Exception as e:
pprint.pprint(e)
pass
はstream=True
に注意してください。
問題は、私は入力にa
b
c
d
を持っている場合、スクリプトはちょうどa
b
とc
を出力します。次に、e
が入力されると、スクリプトはd
を出力します。
私は間違っていますか?
例外がありますか? (フルコードを表示してください) – sokoli
'response.text()'を出力すると、行には?カールの使用はどうですか? 'Content-Length:'ヘッダは適切に設定されていますか? –
私は2015年2月に提出した[このバグ](https://github.com/kennethreitz/requests/issues/2433)にちょうどヒットしたと思います。 – larsks