Example #1
0
	def __init__(self, options=None, **args):
		"""Create Mozu Client object

		Usage::
			>>> import mozurestsdk
			>>> client = mozurestsdk.MozuClient(applicationKey='appKey', shareSecret='sharedsecret')
			>>> or
			>>> client = mozurestsdk.MozuClient(configFile='path to config')
		"""

		args = util.merge_dict(options or {}, args);
		
		configFile = args.get("config", None);
		if (configFile != None):
			args = util.merge_dict(util.readConfigFile(configFile) or {}, args)
			

		self.verifySSLCert = args.get("verifySSLCert", None);
		if ( self.verifySSLCert is not None):
			self.verifySSLCert = self.verifySSLCert == "True";
		#else:
		#	self.verifySSLCert = True;

		self.baseAuthUrl = args.get("baseAuthUrl", __baseUrl__);
		authScheme = urlparse(self.baseAuthUrl).scheme;
		if (not authScheme):
			self.__scheme = authScheme;
		self.basePCIUrl = args.get("basePCIUrl", __basePciUrl__);
		
		self.appAuth = appauthenticator.configure(**args);
		#self.isAuthenticated = False;
		tenantId = args.get("tenantId", None);
		if (tenantId is not None):
			self.__apiContext = ApiContext(**args);
def set_config(options=None, **args):
	global __appauthenticator__;
	args = util.merge_dict(options or {}, args);
	if (__appauthenticator__ is None):
		configFile = args.get("config", None);
		args = util.merge_dict(util.readConfigFile(configFile) or {}, args);

	applicationKey = args.get("applicationKey", None);
	sharedSecret = args.get("sharedSecret", None);
	baseAuthUrl = args.get("baseAuthUrl", __baseUrl__);
	verifySSLCert = args.get("verifySSLCert", None);
	if (verifySSLCert is not None):
		verifySSLCert = verifySSLCert == "True";
	__appauthenticator__ = AppAuthenticator(applicationKey, sharedSecret, baseAuthUrl, verifySSLCert);
	return __appauthenticator__;
Example #3
0
	def __init__(self, options=None,**args):
		args = util.merge_dict(options or {}, args);
		self.tenantId = args.get("tenantId", None);
		self.siteId = args.get("siteId", None);
		self.catalogId = args.get("catalogId", None);
		self.masterCatalogId = args.get("masterCatalogId", None);
		self.tenantUrl = args.get("tenantUrl", None);
		self.locale = args.get("locale", None);
		self.currency = args.get("currency", None);
		self.userClaim = args.get("userClaim", None);
		self.dataViewMode = args.get("dataViewMode",None);
def default():
	global __appauthenticator__
	if (__appauthenticator__ is None):
		configFile = os.getenv("config", None);
		args = {};
		if (configFile is not None):
			args = util.merge_dict(util.readConfigFile(configFile) or {}, args)

		applicationKey = args.get("applicationKey", os.getenv("applicationKey", None));
		sharedSecret = args.get("sharedSecret", os.getenv("sharedSecret", None));
		baseAuthUrl = args.get("baseAuthUrl", os.getenv("baseAuthUrl",__baseUrl__));
		__appauthenticator__ = AppAuthenticator(applicationKey, sharedSecret, baseAuthUrl, verifySSLCert);
	return __appauthenticator__;