SIDEX: Simple Data Exchange server over HTTP
Project description
Simple Data Exchange server over HTTP
Overview
This package provides a function to launch a simple file server. Getting, putting and deleting files on the server via the HTTP POST method are available. The function setup_sidex()
returns a flask
instance. By calling run()
, you are able to launch a simple file server.
from sidex import setup_sidex
target = '/path/to/directory'
app = setup_sidex(target)
app.run()
Otherwise, you can directly call sidex.server
.
$ python -m sidex.server /path/to/directory
By default, only retrieving files (get
) is available. To enable other functions (put
and delete
), a token
should be set for each method. Of course, the get
function can be restricted by a token
.
The HTTP POST method is available to submit a request. Any request should contain the method
field, which should be one of get
, put
, and delete
. The token
field may be required in some cases. The followings are samples using curl
.
$ curl http:/0.0.0.0:8080/path/to/file -F 'method=get'
$ curl http:/0.0.0.0:8080/path/to/upload -F 'method=put' -F 'payload=@filename' -F 'token=foo'
$ curl http:/0.0.0.0:8080/path/to/delete -F 'method=delete' -F 'token=bar'
The package provides a function, sidex_request()
, which is a wrapper function of requests.post()
. You can directly execute sidex.client
.
$ python -m sidex.client http://0.0.0.0:8080/path/to/file
$ python -m sidex.client http://0.0.0.0:8080/path/to/upload -f upload_file
$ python -m sidex.client http://0.0.0.0:8080/path/to/delete -d
Dependencies
The library is developed on Python 3.7.1, depending on the flask
and requests
packages.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sidex-1.0-py3-none-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aada6b4cf7f56754b76d262a81f8d5f7ef29a4de085313df7ec6febc7d566cb |
|
MD5 | f3683c8606cfca2ee8f1a5d6e3b8e142 |
|
BLAKE2b-256 | 5483ad2dbb38c5861eb60ed2552de4f1f2a070be5fe9ffac4abe48bef1110da2 |