Universal communication interface using File-Like API
Project description
Pylink offers a universal communication interface using File-Like API. For now, only the TCP, UDP, Serial and GSM interfaces are supported.
The aim of this project is to allow any type of communication. It is best suited for projects that have various ways of communicating including IP remote or local serial communication.
Installation
You can install, upgrade, uninstall pylink with these commands:
$ pip install pylink $ pip install --upgrade pylink $ pip uninstall pylink
Or if you don’t have pip:
$ easy_install pylink
Examples
>>> from pylink import TCPLink, link_from_url
>>> link = TCPLink('localhost', 7) # conntect to echo tcp service
>>> link.write('Hello')
2012-06-05 12:44:06,211 INFO: new <TCPLink tcp:127.0.0.1:7> was initialized
2012-06-05 12:44:06,211 INFO: Write : <b'hello'>
>>> link.read() == 'Hello'
2012-06-05 12:44:06,312 INFO: Read : <'hello'>
True
With GSMLink, you shoud specify the modem connection link:
>>> from pylink import GSMLink, SerialLink
>>> link = GSMLink("0678986955", SerialLink("/dev/ttyUSB0", 38400))
>>> link.open()
2012-06-29 15:13:31,637 INFO: new <SerialLink serial:/dev/ttyUSB0:38400:8N1> was initialized
2012-06-29 15:13:31,637 INFO: GSM : Call 0678986955
2012-06-29 15:13:31,638 INFO: Write : <u'ATD0678986955\r\n'>
2012-06-29 15:13:31,648 INFO: GSM : <u'call in progress'>
2012-06-29 15:13:41,649 INFO: GSM : <u'call in progress'>
2012-06-29 15:14:08,075 INFO: Read : <u'\r\nCONNECT 9600\r\n\n\r\n\r\n\r'>
2012-06-29 15:14:08,076 INFO: GSM : <u'Client is ready (\r\nCONNECT 9600\r\n\n\r\n\r\n\r)'>
>>> link.write("TEST\n")
2012-06-29 15:14:16,193 INFO: Write : <u'TEST\n'>
>>> link.read()
2012-06-29 15:14:24,972 INFO: Read : <u'\n\rTEST\n\r'>
TEST
>>> link.close()
2012-06-29 15:29:09,295 INFO: Write : <u'+++'>
2012-06-29 15:29:10,318 INFO: Read : <u'\r\nOK\r\n'>
2012-06-29 15:29:10,318 INFO: Write : <u'ATH\r\n'>
2012-06-29 15:29:10,336 INFO: Read : <u'\r\nOK\r\n'>
2012-06-29 15:29:10,337 INFO: GSM : Hang-up
2012-06-29 15:29:10,437 INFO: Connection <SerialLink serial:/dev/ttyUSB0:38400:8N1> was closed
Contribute
There are several ways to contribute to the project:
Post bugs and feature requests on github.
Fork the repository on Github to start making your changes.
Write a test which shows that the bug was fixed or that the feature works as expected.
Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS.
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
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 pylink_marcogos-0.3.6.tar.gz.
File metadata
- Download URL: pylink_marcogos-0.3.6.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4beb4c7695ccf218972339cfcb5f26da52f5194d3fcdc7cae7826607b5569dbb
|
|
| MD5 |
83444e1f2ea8f3cd24ef210f3a07e9d1
|
|
| BLAKE2b-256 |
a492c0a6cd02d68b6cf0bc464012d3e33369d3bdc9b947e8d9efe62e70226ab4
|
File details
Details for the file PyLink_MarcoGos-0.3.6-py3-none-any.whl.
File metadata
- Download URL: PyLink_MarcoGos-0.3.6-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd58adaeab76b3eff65c8c56687c3783cf96233fda5778ec12d8ea1da64afc30
|
|
| MD5 |
63ae9cee3666c719fbc1a87bef8d329d
|
|
| BLAKE2b-256 |
5f9ba1b0287596366f5f19cc6339da76197b947376c90d211cdaf71daefe2ea3
|