Transmit Server & Client use thrift
Project description
Transmit Server & Client
Install
pip install transmit
Usage
Server
from transmit.server import Server
class TestServer(Server):
def __init__(self,port=18100):
super().__init__(port)
def test_function(self,msg):
print('Testing:',msg)
return {"say":"Happy everyday!!!"}
if __name__ == '__main__':
ts = TestServer()
ts.run()
Result
START SERVER 0.0.0.0:18100
Success Response
{
"code":1,
"msg":"success",
"data":"handle result data. AnyType"
}
Error Response
{
"code":0,
"msg":"error message",
"data":null
}
Client
from transmit.client import Client
with Client("127.0.0.1",18100) as c:
result = c.test_function({"msg":"hello world"})
print(type(result))
print(result)
Result
> <class 'dict'>
> {'say': 'Happy everyday!!!'}
Advanced Usage
- debug mode
debug mode will print and log all request and response data.
# debug server
> python test_server.py --debug 1
# debug client
with Client("127.0.0.1",18100,debug=True) as c:
...
- server cli setting
> python test_server.py --host="127.0.0.1" --port=3000 --workers=3 --type=<process|thread> --debug=1
Refs
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
transmit-0.4.3.tar.gz
(8.5 kB
view details)
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
transmit-0.4.3-py3-none-any.whl
(10.0 kB
view details)
File details
Details for the file transmit-0.4.3.tar.gz.
File metadata
- Download URL: transmit-0.4.3.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42d279b6c92781f35799ff1480aa50af59c9dac5e8d52ab7f38367b4db7e10bf
|
|
| MD5 |
8acc081fc22e2c241920bc5d5d5b14dd
|
|
| BLAKE2b-256 |
30e7e3f1cb9dec9ad12740f18973a1011e7326d1af9a8d96921aa9d4c3f9e2ea
|
File details
Details for the file transmit-0.4.3-py3-none-any.whl.
File metadata
- Download URL: transmit-0.4.3-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5818c778589d3db4a883467bee586957f6f370503d6c905a946187b38632c15e
|
|
| MD5 |
a413242b6d2938da49db609c06ef1110
|
|
| BLAKE2b-256 |
5c66a17298bdc21a2135f4d19420089d117b2e8bc0cfbecfd6315f6ad17c80a5
|