Metadata-Version: 2.0
Name: gakp-inet
Version: 0.2.9
Summary: UNKNOWN
Home-page: https://github.com/danceasarxx/inet
Author: Arewa Olakunle
Author-email: arewa.olakunle@gmail.com
License: BSD
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: gevent (==1.1.1)
Requires-Dist: gipc (==0.6.0)
Requires-Dist: greenlet (==0.4.9)
Requires-Dist: plac (==0.9.1)
Requires-Dist: pyzmq (==15.2.0)
Requires-Dist: zmq (==0.0.0)

# inet

**v0.2.4 has bug so you'll have to clone the head**

A simple library built on top of zeromq to enable different python
programs talk over sockets. It works using three components
*server*, *name service* and *client*. The main feature(or use) of this
library is its persistent name service


### Name Service
Start the inet server on command line
```shell
$ inetserver
```

### Server
The server is a function to respond to requests

```python
from inet.inetclient import InetClient
from inet.server import RoutableServer

# talks with the inet server
proxy = InetClient('tcp://127.0.0.1:3014')

# frontend address is what clients connect to while backend address(unix socket)
# is what workers connect to
server = RoutableServer('testservice', proxy, 'tcp://127.0.0.1:4001',
                        'ipc:///tmp/inet.testservice.sock')


@server.route('hello/world')
def hello(req, resp):
    resp.data['greeting'] = 'World'
    return resp

server.setup(localproxy=False)
# spawn default(3) number of workers
server.spawnworkers()
server.loopforever()
```

### Client

```python
from inet.inetclient import InetClient
from inet.client import Client

proxy = InetClient('tcp://127.0.0.1:3014')
client = Client(proxy)

# service name acts as protocol
resp = client.get('testservice://hello/world')
print(resp.meta['status'])  # 200
print(resp.data['greeting']) # 'World'
```


*N.B*: Notes that it uses gevent for managing workers

