Python stream post data
by shogun1234 from LinuxQuestions.org on (#4TJXT)
I have a python script that I want to stream sending json to the server side.
The script code follows the example https://requests.kennethreitz.org/en...eaming-uploads and its code looks like
Code:#!/usr/bin/env python3
import requests
url = "http://localhost:8888/streaming_test"
with open("/path/to/data.json", 'rb') as fs:
req = requests.post(url, data=fs)
print(req)
print(req.text)But it throws error ValueError: invalid literal for int() with base 16: b''
What goes wrong? How can I fix that? Thanks


The script code follows the example https://requests.kennethreitz.org/en...eaming-uploads and its code looks like
Code:#!/usr/bin/env python3
import requests
url = "http://localhost:8888/streaming_test"
with open("/path/to/data.json", 'rb') as fs:
req = requests.post(url, data=fs)
print(req)
print(req.text)But it throws error ValueError: invalid literal for int() with base 16: b''
What goes wrong? How can I fix that? Thanks