HttpClientMultipart
Description
This package implement client to upload file using HTTP multipart.
Requirements
This package require :
- python3
- python3 Standard Library
Installation
pip install HttpClientMultipart
Usages
Command line
HttpMultipart -h
HttpMultipart --help
HttpMultipart -u "http://example.com/post/file"
python3 -m HttpMultipart --url "http://example.com/post/file"
python3 HttpMultipart.pyz -H "Referer:http://example.com/" "Cookie:S=123" -u "http://example.com/post/file"
HttpMultipart --add-headers "Referer:http://example.com/" "Cookie:S=123" -u "http://example.com/post/file"
HttpMultipart -p "submit:Upload" -u "http://example.com/post/file"
HttpMultipart --add-parameters "submit:Upload" -u "http://example.com/post/file"
HttpMultipart -f "/home/user/test.csv" -u "http://example.com/post/file"
HttpMultipart --files-path "/home/user/test.csv" -u "http://example.com/post/file"
Python script
from HttpClientMultipart import Multipart
from urllib.request import Request, urlopen
multipart = Multipart()
response = urlopen(
Request("http://example.com/post/file",
headers={'Content-Type': multipart.content_type},
data=multipart.build_multipart([("SubmitButton", "Upload file")], [("file", "test.csv", "/home/user/test.csv")]),
)
)
print(response.read())
Links
License
Licensed under the GPL, version 3.