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 --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.3.0.tar.gz
(7.4 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
File details
Details for the file transmit-0.3.0.tar.gz.
File metadata
- Download URL: transmit-0.3.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab7707e219d730d63be16d44d622a994c612c58f3453573531005825f2dd1951
|
|
| MD5 |
6c54ebafe5f6638f25adce2530428565
|
|
| BLAKE2b-256 |
66be6c1984e5294cf93432f2f646d4747469419df608b31450443fb7c806ab89
|
File details
Details for the file transmit-0.3.0-py3-none-any.whl.
File metadata
- Download URL: transmit-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a95cd9cc1dcca2335a4e5d07bdffd3c61a797fae3cf999f78b48988a48dc7a30
|
|
| MD5 |
44689fa0129d627ee834701353c31320
|
|
| BLAKE2b-256 |
0342143589f497613759f0a6ac8134a8acd8cb3be45c7ecaee1a8db3722b795c
|