This package implement client to upload file using HTTP multipart
Project description
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 # Print help message
HttpMultipart --help # Print help message
HttpMultipart -u "http://example.com/post/file"
python3 -m HttpMultipart --url "http://example.com/post/file" # Using module command line
python3 HttpMultipart.pyz -H "Referer:http://example.com/" "Cookie:S=123" -u "http://example.com/post/file" # Using python executable file, add headers
HttpMultipart --add-headers "Referer:http://example.com/" "Cookie:S=123" -u "http://example.com/post/file" # Add headers
HttpMultipart -p "submit:Upload" -u "http://example.com/post/file" # Add simple field
HttpMultipart --add-parameters "submit:Upload" -u "http://example.com/post/file" # Add simple field
HttpMultipart -f "/home/user/test.csv" -u "http://example.com/post/file" # Add file
HttpMultipart --files-path "/home/user/test.csv" -u "http://example.com/post/file" # Add 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
HttpClientMultipart-0.0.1.tar.gz
(17.5 kB
view hashes)
Close
Hashes for HttpClientMultipart-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2692a256332f664d2e18f72bf89d1f15f6327c30cf7dc6d4cc94a1b144674d29 |
|
MD5 | e2c8d184211fd8f187f2c7c527d7f42a |
|
BLAKE2b-256 | e6c6ccb4946dafd0d02e0426e925527612eafb089417b9592b981ab07ff5fba9 |