====== Picolibs SettingsClient ======
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**
==== Methods: ====
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 , the apikey string
get_mongo_prefix_by_shopid(shop_id, timeout=5)
Out: None, if any errors in settings-provider.
mongo_prefix , 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 , the shop_id string
get_all_shopids(timeout=5)
Out: None, if any errors in settings-provider.
, the list that contains all shop_ids found
==== Small coding exemple ====
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