snoonetirc / async-irc Goto Github PK
View Code? Open in Web Editor NEWAn implementation of the asyncio Protocol interface for IRC connections
License: MIT License
An implementation of the asyncio Protocol interface for IRC connections
License: MIT License
Attempting to do a little test. Not sure if this is a bug in async-irc or my usage.
# main.py
import asyncio
from asyncirc.protocol import IrcProtocol
from asyncirc.server import Server
servers = [
Server("irc.freenode.net", 6667),
]
async def log(conn, message):
print(message)
async def main():
conn = IrcProtocol(servers, "BotNick", loop=loop)
conn.register_cap('userhost-in-names')
conn.register('*', log)
await conn.connect()
await asyncio.sleep(24 * 60 * 60)
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(main())
except KeyboardInterrupt:
pass
finally:
loop.stop()
$ python ./main.py
:Delphini.GA.US.StarChat.Net NOTICE * :*** Looking up your hostname...
:Delphini.GA.US.StarChat.Net NOTICE * :*** Couldn't resolve your hostname; using your IP address instead
:Delphini.GA.US.StarChat.Net CAP * LS :unrealircd.org/plaintext-policy=user=allow,oper=warn,server=deny unrealircd.org/link-security=1 extended-join chghost cap-notify userhost-in-names multi-prefix away-notify account-notify sasl=EXTERNAL,PLAIN tls
PING :85762D26
Task exception was never retrieved
future: <Task finished coro=<_internal_cap_handler() done, defined at /lib/python3.6/site-packages/asyncirc/protocol.py:40> exception=KeyError('',)>
Traceback (most recent call last):
File "/lib/python3.6/site-packages/asyncirc/protocol.py", line 59, in _internal_cap_handler
current = conn.server.caps[cap.name][0]
KeyError: ''
:Delphini.GA.US.StarChat.Net CAP BotNick ACK :userhost-in-names
:Delphini.GA.US.StarChat.Net CAP BotNick ACK :sasl
Task exception was never retrieved
future: <Task finished coro=<_internal_cap_handler() done, defined at /lib/python3.6/site-packages/asyncirc/protocol.py:40> exception=KeyError('',)>
Traceback (most recent call last):
File "/lib/python3.6/site-packages/asyncirc/protocol.py", line 59, in _internal_cap_handler
current = conn.server.caps[cap.name][0]
KeyError: ''
$ pip freeze
async-irc==0.1.7
py-irclib==0.1.4
For some reason the caplist has two elements in it, sasl
and an empty/blank cap. I worked around it will a try/except:
try:
current = conn.server.caps[cap.name][0]
conn.server.caps[cap.name] = (current, enabled)
if enabled:
handlers = filter(None, conn.cap_handlers[cap.name])
await asyncio.gather(*[func(conn, cap) for func in handlers])
except KeyError:
pass
Dependabot couldn't authenticate with https://pypi.python.org/simple/.
You can provide authentication details in your Dependabot dashboard by clicking into the account menu (in the top right) and selecting 'Config variables'.
MONITOR
Possibly implement the exponential back-off algorithm to avoid attempting to reconnect as fast as possible
This would add the ability to upgrade an existing connection to SSL/TLS using STARTTLS automatically
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.