Article 4TJXT Python stream post data

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? Thankslatest?d=yIl2AUoC8zA latest?i=QlRZTnOgTg8:NdoIJthCQzs:F7zBnMy latest?i=QlRZTnOgTg8:NdoIJthCQzs:V_sGLiP latest?d=qj6IDK7rITs latest?i=QlRZTnOgTg8:NdoIJthCQzs:gIN9vFwQlRZTnOgTg8
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments