in pulsar/__init__.py [0:0]
def __init__(self, username=None, password=None, method='basic', auth_params_string=None):
"""
Create the Basic authentication provider instance.
For example, if you want to create a basic authentication instance whose
username is "my-user" and password is "my-pass", there are two ways:
.. code-block:: python
auth = AuthenticationBasic('my-user', 'my-pass')
auth = AuthenticationBasic(auth_params_string='{"username": "my-user", "password": "my-pass"}')
Parameters
----------
username : str, optional
password : str, optional
method : str, default='basic'
The authentication method name
auth_params_string : str, optional
The JSON presentation of all fields above. If it's not None, the other parameters will be ignored.
Here is an example JSON presentation:
{"username": "my-user", "password": "my-pass", "method": "oms3.0"}
The ``username`` and ``password`` fields are required. If the "method" field is not set, it will be
"basic" by default.
"""
if auth_params_string is not None:
_check_type(str, auth_params_string, 'auth_params_string')
self.auth = _pulsar.AuthenticationBasic.create(auth_params_string)
else:
_check_type(str, username, 'username')
_check_type(str, password, 'password')
_check_type(str, method, 'method')
self.auth = _pulsar.AuthenticationBasic.create(username, password, method)