The settings Client from Picolibs is a middleware to pick settings and information from our data-system. The Settings Client, needs a parameter: the address from the settings provider.
If a method fails, or a response from settings-provider, came with error status. The settings provider returns None
get_info_by_shopid(shop_id, timeout=5)
Out: None, if any errors in settings-provider. { key: value } , all dictionary that is in "info" key.
get_apikey_by_shopid(shop_id, timeout=5) Out: None, if any errors in settings-provider. apikey<str> , the apikey string
get_mongo_prefix_by_shopid(shop_id, timeout=5)
Out: None, if any errors in settings-provider. mongo_prefix<str> , the mongo-prefix string PS: If the mongo_prefix key not in controller, it uses the shop_id as mongo_prefix
get_shopid_by_apikey(apikey, timeout=5)
Out: None, if any errors in settings-provider. shop_id<str> , the shop_id string
get_all_shopids(timeout=5)
Out: None, if any errors in settings-provider. <list> , the list that contains all shop_ids found
from picolibs.settings_client import SettingsClient as set_client ip = "http://127.0.0.1:6670/" sc = set_client(ip) resp = sc.get_info_by_shopid(shopid) #Returns dict or None resp = sc.get_apikey_by_shopid(shopid) #Returns str or None resp = sc.get_mongo_prefix_by_shopid(shopid) #Returns str or None resp = sc.get_shopid_by_apikey(apikey) #Returns str or None resp = sc.get_all_shopids() #Returns a list or None. resp = sc.get_settings(shop_id, field (optional)) # Returns the settings for a shop id. #If no field given, it returns all settings. Raises a KeyErrorException if no field found in the settings