Skip to main content

SIDEX: Simple Data Exchange server over HTTP

Project description

License: MIT CodeQL Documentation Status

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

sidex-1.5.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sidex-1.5.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file sidex-1.5.1.tar.gz.

File metadata

  • Download URL: sidex-1.5.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for sidex-1.5.1.tar.gz
Algorithm Hash digest
SHA256 6b44322d904fa070833e10ae1442f1321b925c987528cd4c69e1b3f32f2fdae5
MD5 8dbf93929164f98a88c8f03ef8af0ff4
BLAKE2b-256 8cda62010aeced6b06d34976c9609b2895d6b8ff7530173d9cf88b5d17cf14a0

See more details on using hashes here.

File details

Details for the file sidex-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: sidex-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for sidex-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa4eac4f017b28c1af31e6baad5ebed68c684d79b87b56fcccc84b7821d53a7a
MD5 73bab7bae506141bb65267965ca69119
BLAKE2b-256 90f30f4b1feacaef033156bfd8416688487b10075ddfe8a850fa1267e087cbc0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page