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 methods are available. The function setup_sidex() returns a flask instance. You can launch a simple file server by run().
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. The put and delete methods are enabled by setting a 'token' 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 with 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/file --ping
$ 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.9.9. The following packages are required:
flask>=2.0
requests>=2.27
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sidex-1.5.tar.gz.
File metadata
- Download URL: sidex-1.5.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ef0146d9e3074bf2fdb12381181c6c44beb6108ae67b75c3fb538527292f4da
|
|
| MD5 |
c16b0cce894fc61c646c09cf396a8748
|
|
| BLAKE2b-256 |
4cc9d27541e6ed8a60d5f62554e9fa1dd6ff8c9a56ed28248fbdda72b2cc04f5
|
File details
Details for the file sidex-1.5-py3-none-manylinux1_x86_64.whl.
File metadata
- Download URL: sidex-1.5-py3-none-manylinux1_x86_64.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30e0f2ff0fb6d3e92b095ff19fd4889ed6a6ecf2b575fe2ff6f6a089d71ab62b
|
|
| MD5 |
114adbedfff64d5d4d843f8590be8fb2
|
|
| BLAKE2b-256 |
c07bb9f9a6c8abbab1d256be72a68b02d419362dd1a44a184cf42b2968aaa351
|