Skip to content

Instantly share code, notes, and snippets.

@rahulvramesh
Last active February 27, 2020 09:13
Show Gist options
  • Select an option

  • Save rahulvramesh/0d5c5a44a469f7fb6e91ca4196c2993e to your computer and use it in GitHub Desktop.

Select an option

Save rahulvramesh/0d5c5a44a469f7fb6e91ca4196c2993e to your computer and use it in GitHub Desktop.
import requests
import os
import http.client as http_client
import logging
http_client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
image_filename = os.path.basename("/Users/rahulvramesh/Downloads/HHmachine001_HHdevice01_camera02_2020-02-26-18_19_22.mp4")
multipart_form_data = {
'file': (image_filename, open("/Users/rahulvramesh/Downloads/HHmachine001_HHdevice01_camera02_2020-02-26-18_19_22.mp4", 'rb')),
}
print(image_filename)
print(multipart_form_data)
response = requests.post('http://18.141.141.91:8005/upload',
files=multipart_form_data)
print(response.text)
#Total Time To Upload
#0.16s user 0.18s system 0% cpu 59.017 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment