def __init__(self, username, password, auth_url, project_name, user_domain_name=None, project_domain_name=None, ca_path=None): CoreCredentials.__init__(self, collections.OrderedDict({username: password})) self.auth_url = auth_url self.project_name = project_name self.user_domain_name = user_domain_name self.project_domain_name = project_domain_name self.ca_path = ca_path # Decode the version self.version = None for version in self._supported_keystone_versions: if auth_url[-len(version):].lower() == version: self.version = version break if self.version is None: raise ValueError('{}: Unknown or unsupported Keystone version'. format(auth_url)) # Is SSL being used self.is_ssl = auth_url[:5].lower() == 'https' if self.is_ssl: if self.ca_path is None: raise ValueError('A path to a certificates file is required if SSL is in use') elif not os.path.exists(self.ca_path): raise IOError("Certificate file '{}' does not exist".format(self.ca_path))
import MySQLdb import sys import re sys.path.append("..") from datetime import datetime, timedelta from core.credentials import Credentials from model.feedback import Feedback from model.sale import Sale from model.fulfillment import Fulfillment from sync.getSales import getSales from sync.getFeedback import getFeedback from sync.getFulfillment import getFulfillment credentials = Credentials() db = MySQLdb.connect(db=credentials.db_name, user=credentials.db_user, passwd=credentials.db_password) # Get sales sales = getSales(db, credentials) sales.fetch().parse() # Get Feedback sale = Sale(db) legacy_order_ids = sale.getLegacyOrderIds() for order_id in legacy_order_ids: if (re.match(r'[0-9]{12}-[0-9]{13}', str(order_id[0]))): getFeedback(db, credentials).fetch(order_id[0])
def __init__(self): self.credentials = Credentials() self.compat_level = 1119 self.site_id = 3
def __init__(self, username, password, address, port): Credentials.__init__(self, collections.OrderedDict({username: password})) self.address = address self.port = port