upload to http server in python

main.py
import requests

url = 'https://www.example.com/upload'
files = {'file': open('example.txt', 'rb')}

response = requests.post(url, files=files)

print(response.text)
166 chars
9 lines

Note: Make sure to replace the URL and file name with your own details.

related categories

gistlibby LogSnag