https://github.com/toastdriven/sockless
A friendlier interface to `socket`.
https://github.com/toastdriven/sockless
Last synced: 11 months ago
JSON representation
A friendlier interface to `socket`.
- Host: GitHub
- URL: https://github.com/toastdriven/sockless
- Owner: toastdriven
- License: bsd-3-clause
- Created: 2015-04-05T00:12:45.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-11T21:34:03.000Z (about 11 years ago)
- Last Synced: 2025-06-07T16:54:58.139Z (11 months ago)
- Language: Python
- Size: 125 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
sockless
========
A friendlier interface to `socket`.
Emulates file-like objects.
.. code:: python
import sockless
with sockless.open('irc.freenode.net:6665', mode='rw') as sock:
# Writing.
sock.write('NICK atestbot\r\n')
sock.write('USER atestbot bot@aserver.com unused :atestbot\r\n')
sock.write('JOIN #testbot\r\n')
# Reading lines from a socket.
for line in sock:
if not line:
break
if 'End of /NAMES list' in line:
print "Successfully connected & joined. Quitting."
break
print line.strip()
TODO
----
* Tests
* Docs
* Python 3 support