Skip to content

Commit

Permalink
Merge pull request #120 from Shizmob/develop
Browse files Browse the repository at this point in the history
Release 0.9.2
  • Loading branch information
theunkn0wn1 authored Aug 5, 2019
2 parents 7ec7d65 + 013057f commit b60e22d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Features

Basic Usage
-----------
`python3 setup.py install`
`pip install pydle`

From there, you can `import pydle` and subclass `pydle.Client` for your own functionality.

Expand Down
47 changes: 47 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,53 @@ This trivial example shows a few things:
was implemented or no callbacks overridden.

.. _`advanced string formatting`: http://legacy.python.org/dev/peps/pep-3101/
Authentication
-----------------
Pydle can also handle authenticating against IRC services by default, all you need to do is tell
it what its credentials are.

.. note::
the server must support SASL based authentication.

-----------
SASL(Username + password)
-----------
To authenticate, pydle simply needs to be provided with a set of credentials to present during the
connection process, the most common type being a username+password pair

.. code:: python
import pydle
client = pydle.Client(
nickname="my_irc_bot[bot]",
sasl_username = "username",
sasl_password = "my_secret_bot_password",
sasl_identity = "account_to_identify_against",
)
-----------
External authentication (Certificate)
-----------
As an alternative to using passwords for credentials, certificates can also be used via the
SASL (External) authentication method.

All you need to do is tell pydle where it can find the certificate, which it will then present
during the TLS handshake when connecting to the server.

.. code:: python
import pydle
client = pydle.Client(
nickname="my_irc_bot[bot]",
sasl_mechanism = "EXTERNAL",
tls_client_cert = "/path/to/client_certificate"
)
.. note::
this authentication mode only works over TLS connections


Multiple servers, multiple clients
----------------------------------
Expand Down
4 changes: 2 additions & 2 deletions pydle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from asyncio import coroutine, Future

__name__ = 'pydle'
__version__ = '0.9.1'
__version_info__ = (0, 9, 1)
__version__ = '0.9.2'
__version_info__ = (0, 9, 2)
__license__ = 'BSD'


Expand Down
12 changes: 6 additions & 6 deletions pydle/features/ctcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Client-to-Client-Protocol (CTCP) support.
import pydle.protocol
from pydle.features import rfc1459

from pydle import client
__all__ = [ 'CTCPSupport' ]


Expand Down Expand Up @@ -36,7 +36,7 @@ async def on_ctcp_version(self, by, target, contents):
import pydle

version = '{name} v{ver}'.format(name=pydle.__name__, ver=pydle.__version__)
self.ctcp_reply(by, 'VERSION', version)
await self.ctcp_reply(by, 'VERSION', version)


## IRC API.
Expand Down Expand Up @@ -84,14 +84,14 @@ async def on_raw_notice(self, message):

if is_ctcp(msg):
self._sync_user(nick, metadata)
type, response = parse_ctcp(msg)
_type, response = parse_ctcp(msg)

# Find dedicated handler if it exists.
attr = 'on_ctcp_' + pydle.protocol.identifierify(type) + '_reply'
attr = 'on_ctcp_' + pydle.protocol.identifierify(_type) + '_reply'
if hasattr(self, attr):
await getattr(self, attr)(user, target, response)
await getattr(self, attr)(nick, target, response)
# Invoke global handler.
await self.on_ctcp_reply(user, target, type, response)
await self.on_ctcp_reply(nick, target, _type, response)
else:
await super().on_raw_notice(message)

Expand Down
2 changes: 1 addition & 1 deletion pydle/features/rfc1459/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ async def on_raw_353(self, message):
self.channels[channel]['public'] = False

# Update channel user list.
for entry in names.split():
for entry in names.split(' '):
statuses = []
# Make entry safe for _parse_user().
safe_entry = entry.lstrip(''.join(self._nickname_prefixes.keys()))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pydle',
version='0.9.1',
version='0.9.2',
python_requires=">=3.5",
packages=[
'pydle',
Expand Down

0 comments on commit b60e22d

Please sign in to comment.