ez_process module¶
eZAPI¶
- class ez_process.ez_api.ez_api(**kwargs)[source]¶
Bases: ez_process.ez_process_base.ez_process_base
Retrieving user information and handling commands.
Class ez_api brings along abunch of methods intended to be called directly by the user. The class is inherited by the client via ez_process which makes the methods available for the UI. It also takes care of the user and message database.
Class variable name, declareing the user_id, is required for initiating ez_api and is specified by the keyword 'name'
Class variable UserDatabase represents the Database where contact information is stored, i.e. Usernames, Database user ids (UIDs), possibly current IP and latest IPs and the Public key.
Class variable MsgDatabase represents the Database storing messages. Messages cannot be read unless a valid private key is available.
- cmd_add(user_id, host, port)[source]¶
Add user IP to clients IP list.
Parameters: - user_id (string) – id specifying the username
- host (string) – hosts IP
- port (integer) – hosts port
- cmd_authentificate(host, port)[source]¶
Connect to a server with authentification.
A connection to a server enables the use of ez_process.ez_api.ez_api.cmd_ips().
Parameters: - host (string) – server IP
- port (integer) – server port
- cmd_connect(host, port)[source]¶
Connect to a server.
A connection to a server enables the use of ez_process.ez_api.ez_api.cmd_ips().
Parameters: - host (string) – server IP
- port (integer) – server port
- cmd_ips(user_id)[source]¶
Request IPs from a user in servermode.
Parameters: user_id (string) – clients username
- cmd_passive_sync()[source]¶
Initiate passive mesage database syncing. The frequency is determined in ez_process_preferences.
- cmd_send_msg(user_id, msg)[source]¶
Send an encrypted message.
The method requires the the target client to be online. The encryption can be done only if a valid public key of the targets client is available.
Parameters: - user_id (string) – clients username
- msg (string) – message
- cmd_servermode(host, port)[source]¶
Switch the client to servermode enabling to connect other users.
A users in the network can use the method ez_process.ez_api.ez_api.cmd_ips() to ask the client for connection. The client then relays the request to other users and connects them which each other. The connection process is described by the class ez_process.ez_relay.ez_relay
Parameters: - host (string) – hosts IP
- port (integer) – port on which to listen to