aiogbclient.utils package
Submodules
aiogbclient.utils.client_messages module
-
class
aiogbclient.utils.client_messages.
JimClientMessage
[source]
Bases: object
Client’s requests protocol
-
auth
(username, password)[source]
Authorization message
Parameters: |
|
Returns: | dict with data
|
-
list_
(sender, status='show', person='')[source]
List message, which can add/delete/show contacts from user’s ContactList
Parameters: |
- sender – username
- status – possible statuses are: show/add/del
- person – user from contact list
|
Returns: | dict with data
|
-
message
(sender, receiver='user1', text='some msg text')[source]
Simple message between two client’s (client -> client)
Parameters: |
- sender – username
- receiver – account name. message to
- text – message’s text
|
Returns: | dict with data
|
-
presence
(sender, status='Yep, I am here!')[source]
Presence message, which notify server that client is online.
:param sender: username
:param status: some text
:return: dict with data
-
quit
(sender, status='disconnect')[source]
Quit message, which notify server that client want to disconnect
Parameters: |
- sender – username
- status – some text
|
Returns: | dict with data
|
aiogbclient.utils.client_proto module
-
class
aiogbclient.utils.client_proto.
ChatClientProtocol
(db_path, loop, tasks=None, username=None, password=None, gui_instance=None, **kwargs)[source]
Bases: asyncio.protocols.Protocol
, aiogbclient.utils.mixins.ConvertMixin
, aiogbclient.utils.mixins.DbInterfaceMixin
-
connection_lost
(exc)[source]
Disconnect from the server
-
connection_made
(transport)[source]
Called when connection is initiated
-
data_received
(data)[source]
Receive data from server and send output message to console/gui
:param data: json-like dict in bytes
:return:
-
get_from_console
()[source]
Recieve messages from Console
:param loop:
:return:
-
get_from_gui
()[source]
-
output_to_console
(data)[source]
print output data to terminal
Parameters: | data – msg dictionary |
Returns: | |
-
output_to_gui
(msg, response=False)[source]
send update signal to GUI client
Parameters: | response – raw response from server {‘response’:200} |
Returns: | |
-
send
(request)[source]
Send json-like message
Parameters: | request – dict message |
Returns: | |
-
send_auth
(user, password)[source]
send authenticate message to the server
-
send_msg
(to_user, content)[source]
send msg request to user from contact’s list
:param to_user: receiver
:param content: text msg
:return:
-
class
aiogbclient.utils.client_proto.
ClientAuth
(db_path, username=None, password=None)[source]
Bases: aiogbclient.utils.mixins.ConvertMixin
, aiogbclient.utils.mixins.DbInterfaceMixin
Authentication server
-
authenticate
()[source]
authentication method, which verify user in DB
aiogbclient.utils.log_config module
aiogbclient.utils.mixins module
-
class
aiogbclient.utils.mixins.
ConvertMixin
[source]
Bases: object
-
class
aiogbclient.utils.mixins.
DbInterfaceMixin
(db_path)[source]
Bases: object
-
add_client
(username, info=None)[source]
-
add_client_history
(client_username, ip_addr='8.8.8.8')[source]
-
add_client_message
(client_username, contact_username, text_msg)[source]
-
add_contact
(client_username, contact_username)[source]
-
del_contact
(client_username, contact_username)[source]
-
get_all_clients
()[source]
-
get_client_by_username
(username)[source]
-
get_client_history
(client_username)[source]
-
get_client_messages
(client_username)[source]
-
get_contacts
(client_username)[source]
-
get_user_status
(client_username)[source]
-
set_user_offline
(client_username)[source]
-
set_user_online
(client_username)[source]
Module contents