A general package that has useful functionalities
Project description
General Utilities
Includes:
- Logger Module
- Redis Client
- RabbitMQ Client
- MinIo Client
- API Requests
CLASSES:
class FileStorage(builtins.object)
| FileStorage(url, user, pwd)
|
| Used for interacting wiht Redis.
| Args:
| host (str): url for connection
| user (str): user name
| pwd (str): password
| Returns:
| None
| Methods:
| get_data() : for fetching data corresponding to a redis-key
|
| Methods defined here:
|
| __init__(self, url, user, pwd)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_data(self, bucket_name, file_name, data_type='csv')
| Used for fetching a file from MinIO from a specific bucket.
| Args:
| bucket_name (str): MinIO bucket name
| file_name (str): unique file name
| data_type (str)[default:'csv']: type of data to read
| Returns:
| Data (df/dict)
|
| set_connection(self, url, user, pwd)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class REDIS(builtins.object)
| REDIS(host, port)
|
| Used for interacting wiht Redis.
| Args:
| host (str): host for connection
| port (int): port as int
| Returns:
| None
| Methods:
| get_data() : for fetching data corresponding to a redis-key
| set_data() : for insert data corresponding to a redis-key
|
| Methods defined here:
|
| __init__(self, host, port)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_data(self, redis_key, data_type='dict')
| Used for fetching data from Redis corresponding to a specific key.
| Args:
| redis_key (str): uniquu redis-key
| data_type (str)[default:'dict']: type of data stored with the redis-key (options:dict, df)
| Returns:
| Data (df/dict)
|
| set_connection(self, host, port)
|
| set_data(self, redis_key, data, data_type='dict')
| Used for inserting data to Redis corresponding to a specific key.
| Args:
| redis_key (str): uniquu redis-key
| redis_key (str): uniquu redis-key
| data_type (str)[default:'dict']: type of data stored with the redis-key (options:dict, df)
| Returns:
| Data (df/dict)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class RMQ(builtins.object)
| RMQ(host, port, user, pwd)
|
| Used for interacting wiht RabbitMQ.
| Args:
| host (str): host for connection
| port (int): port as int
| user (str): user_name
| pwd (str): password
| Returns:
| None
| Methods:
| listen() : for consuming messages
| publish() : for sending mesages
|
| Methods defined here:
|
| __init__(self, host, port, user, pwd)
| Initialize self. See help(type(self)) for accurate signature.
|
| callback(self, ch, method, properties, body)
|
| listen(self, consume_queue, callback_func, publish_fl=False, publish_queue='')
| Used for listening to messages (continuous).
| Args:
| consume_queue (str): queue_name to listen
| callback_func (function): pass a funtion which takes a str as input(the message recieved)
| publish_fl (bool)[default:True]: 'True', if some message to publish after callback_func()
| publish_queue (str)[default:""]: queue_name to publish
| Returns:
| None [continuously waits for messages, never terminate]
|
| publish(self, msg_dict, publish_queue)
| Used for publishing messages.
| Args:
| msg_dict (dict): message to publish (dict)
| publish_queue (str): queue_name to publish
| Returns:
| None
|
| set_connection(self, host, port, user, pwd)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
FUNCTIONS
logger()
Used for logging in cmd line.
Args:
None
Returns:
None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
general_utils-0.1.0.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file general_utils-0.1.0.tar.gz
.
File metadata
- Download URL: general_utils-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a89b052f703f82abb197615862378afee903d30a0e926cb6ae718db2172cc48 |
|
MD5 | e23ef939ed2b948a6667b425deec42be |
|
BLAKE2b-256 | 25aea40d379f1e420ecd69997b2688abc38c1aaeb1cea019379379a426cc933b |
File details
Details for the file general_utils-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: general_utils-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63675ae2d57485fc8fcb973416ce7fbf3a5266e2591ac6d8d2d7de0786d94c47 |
|
MD5 | a778e1c227e09b5a7df8dd1940a8f587 |
|
BLAKE2b-256 | 8038368e8c4829bb04a8c1c9e43432b5331e023f24ce9b2414c05f98098146d3 |