Question

I am trying to figure out the best way to send out an avro object within an http request. I was thinking about performing this via python. I am a little confused about how this can be achieved. Would I be creating a POST request with the data attribute equal to the location where the avro file is located? Is there a way to create a whole bunch of avro objects on the fly and instead of storing them in a physical location, stream them into the POST request? I am not sure how byte arrays can be send across the wire to the server. It will be great to get some insight into the fundamentals of this process.

Thanks

Was it helpful?

Solution

You might find python requests useful.

http://www.python-requests.org/en/latest/user/quickstart/#

$pip install requests

>>> import requests
>>> url = 'http://httpbin.org/post'
>>> files = {'file': open('report.xls', 'rb')}

>>> r = requests.post(url, files=files)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top