当前位置: 首页>>代码示例>>Python>>正文


Python settings.PASSWORD属性代码示例

本文整理汇总了Python中settings.PASSWORD属性的典型用法代码示例。如果您正苦于以下问题:Python settings.PASSWORD属性的具体用法?Python settings.PASSWORD怎么用?Python settings.PASSWORD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在settings的用法示例。


在下文中一共展示了settings.PASSWORD属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: search

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def search(vector, k=10):
    """
        vector: numpy array vector

        Return: predicted name of the face and search time
    """
    db = DBObject(db=DB_NAME, user=USER, password=PASSWORD)
    q = 'SELECT name from images order by vector <-> %s asc limit %s'
    _vector = AsIs('cube(ARRAY[' + ','.join(str(vector).strip('[|]').split()) + '])')
    start = time.time()
    try:
        results = db.make_query(q, (_vector, str(k)),q_type='query')
    except Exception as e:
        raise e
    total = time.time() - start
    return ' '.join(results[0][0].split('_')[:-1]), total 
开发者ID:lehgtrung,项目名称:face-search,代码行数:18,代码来源:face_query.py

示例2: soap_get_password_order

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def soap_get_password_order(client):
	method_url = METHOD_ORDER_URL[settings.LIVE] + 'getPassword'
	svc_url = SVC_ORDER_URL[settings.LIVE]
	header_value = soap_set_wsa_headers(method_url, svc_url)
	response = client.service.getPassword(
		UserId=settings.USERID[settings.LIVE], 
		Password=settings.PASSWORD[settings.LIVE], 
		PassKey=settings.PASSKEY[settings.LIVE], 
		_soapheaders=[header_value]
	)
	print
	response = response.split('|')
	status = response[0]
	if (status == '100'):
		# login successful
		pass_dict = {'password': response[1], 'passkey': settings.PASSKEY[settings.LIVE]}
		return pass_dict
	else:
		raise Exception(
			"BSE error 640: Login unsuccessful for Order API endpoint"
		)


## fire SOAP query to get password for Upload API endpoint
## used by all functions except create_transaction_bse() and cancel_transaction_bse() 
开发者ID:utkarshohm,项目名称:mf-platform-bse,代码行数:27,代码来源:api.py

示例3: soap_get_password_upload

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def soap_get_password_upload(client):
	method_url = METHOD_UPLOAD_URL[settings.LIVE] + 'getPassword'
	svc_url = SVC_UPLOAD_URL[settings.LIVE]
	header_value = soap_set_wsa_headers(method_url, svc_url)
	response = client.service.getPassword(
		MemberId=settings.MEMBERID[settings.LIVE], 
		UserId=settings.USERID[settings.LIVE],
		Password=settings.PASSWORD[settings.LIVE], 
		PassKey=settings.PASSKEY[settings.LIVE], 
		_soapheaders=[header_value]
	)
	print
	response = response.split('|')
	status = response[0]
	if (status == '100'):
		# login successful
		pass_dict = {'password': response[1], 'passkey': settings.PASSKEY[settings.LIVE]}
		return pass_dict
	else:
		raise Exception(
			"BSE error 640: Login unsuccessful for upload API endpoint"
		)


## fire SOAP query to post the order 
开发者ID:utkarshohm,项目名称:mf-platform-bse,代码行数:27,代码来源:api.py

示例4: accuracy

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def accuracy(k=10):
    db = DBObject(db=DB_NAME, user=USER, password=PASSWORD)
    q = 'SELECT name, vector from dev'

    start = time.time()
    dev_images = db.make_query(q, q_type='query')
    total = time.time() - start

    q = 'SELECT name from train order by %s <-> vector asc limit %s'

    count = 0
    for image in dev_images:
        name, vector = image
        _name = '_'.join(name.split('_')[:-1])

        vector = [float(elem) for elem in list(vector.strip('(|)').split(', '))]
        _vector = AsIs('cube(ARRAY[' + str(vector).strip('[|]') + '])')

        candidates = db.make_query(q, (_vector, str(k)), q_type='query')

        most_likely_name = most_common_or_first([candidate[0] for candidate in candidates])

        if most_likely_name.startswith(_name):
            count += 1

    return 1.0*count/len(dev_images), total 
开发者ID:lehgtrung,项目名称:face-search,代码行数:28,代码来源:face_query.py

示例5: prepare_db

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def prepare_db():
    """
    Create a database with name in .env
    """
    try:
        con = psycopg2.connect(dbname='postgres', user=USER, password=PASSWORD)
    except psycopg2.Error as e:
        raise e
    logging.info('Connected to database postgres')
    con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
    cur = con.cursor()
    try:
        cur.execute('CREATE DATABASE ' + DB_NAME)
    except psycopg2.Error as e:
        logging.info('DROP OLD DATABASE')
        logging.info('CREATE NEW DATABASE')
        cur.execute('DROP DATABASE ' + DB_NAME)
        cur.execute('CREATE DATABASE ' + DB_NAME)
    cur.close()
    con.close()

    con = psycopg2.connect(dbname=DB_NAME, user=USER, password=PASSWORD)
    cur = con.cursor()
    cur.execute('CREATE EXTENSION CUBE')
    cur.execute('CREATE TABLE images (id serial, name text, url text, vector cube);')
    con.commit()
    cur.close()
    con.close() 
开发者ID:lehgtrung,项目名称:face-search,代码行数:30,代码来源:db.py

示例6: insert_features

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def insert_features(path, table):
    batches, predictions = get_batch_predictions(path)

    name2vector = {}
    for i, prediction in enumerate(predictions):
        name2vector[batches.filenames[i].split('/')[-1]] = prediction

    db = DBObject(db=DB_NAME, user=USER, password=PASSWORD)
    save_to_db(table, name2vector, db) 
开发者ID:lehgtrung,项目名称:face-search,代码行数:11,代码来源:face.py

示例7: login

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def login(driver):
    '''
    Logs into the BSEStar web portal using login credentials defined in settings
    '''
    try:
        line = "https://www.bsestarmf.in/Index.aspx"
        driver.get(line)
        print("Opened login page")
        
        # enter credentials
        userid = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "txtUserId")))
        memberid = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "txtMemberId")))
        password = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "txtPassword")))
        userid.send_keys(settings.USERID[settings.LIVE])
        memberid.send_keys(settings.MEMBERID[settings.LIVE])
        password.send_keys(settings.PASSWORD[settings.LIVE])
        submit = driver.find_element_by_id("btnLogin")
        submit.click()
        print("Logged in")
        return driver

    except (TimeoutException, NoSuchElementException, StaleElementReferenceException, 
        ErrorInResponseException, ElementNotVisibleException):
        print("Retrying in login")
        return login(driver)

    except (BadStatusLine):
        print("Retrying for BadStatusLine in login")
        driver = init_driver()
        return login(driver) 
开发者ID:utkarshohm,项目名称:mf-platform-bse,代码行数:32,代码来源:web.py

示例8: loginGitStar

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def loginGitStar(self):
		r=requests.post("http://gitstar.top:88/api/user/login",params={'username':settings.NAME,'password':settings.PASSWORD})
		self.cookie = r.headers['Set-Cookie'] 
开发者ID:w568w,项目名称:GitHubFollow,代码行数:5,代码来源:main.py

示例9: get_notifications

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def get_notifications(self, old_count):
        # changes in followers
        # notification
        new_count = self.followers
        notifications = []

        if old_count != new_count:
            if self.username == USERNAME:
                notification_url = URL + '/user/followers'
                target = 'you'

            else:
                notification_url = URL + '/users/' + self.username + '/followers'
                target = self.username

            if new_count > old_count:
                params = {'per_page': self.followers}
                start_page = old_count // 100
                end_page = new_count // 100
                followers = []
                with requests.Session() as s:
                    for i in range(start_page + 1, end_page + 2):
                        params['page'] = i
                        new_page = s.get(notification_url, headers=HEADERS,
                                         params=params, auth=(USERNAME, PASSWORD)).json()
                        #print("Length of page {} : {}".format(i, len(new_page)))
                        followers += new_page

                start_index = old_count % 100
                context = "follow"
                #print("Len of followers:" + str(len(followers)))
                #print("Len of list:" + str(len(followers[start_index:])))
                for user_blob in followers[start_index:]:
                    protagonist = user_blob['login']
                    notifications += [Notification.generate_message(protagonist, context, target)]

            else:
                message = '{} users unfollowed {}'.format(old_count - new_count, target)
                notifications += [Notification(message)]

        return notifications 
开发者ID:kshitij10496,项目名称:gh-notifier,代码行数:43,代码来源:userclass.py

示例10: get_blob

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def get_blob(handle):
    if handle == USERNAME:
        user_url = URL + '/user'

    else:
        user_url = URL + '/users/' + handle

    # print("User = " + USERNAME + " : " + user_url)
    user = requests.get(user_url, headers=HEADERS, auth=(USERNAME, PASSWORD)).json()
    return user 
开发者ID:kshitij10496,项目名称:gh-notifier,代码行数:12,代码来源:userclass.py

示例11: get_repos

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def get_repos(handle):
    if handle == USERNAME:
        repo_url = URL + '/user/repos'

    else:
        repo_url = URL + '/users/' + handle + '/repos'

    repo_response = requests.get(repo_url, headers=HEADERS, auth=(USERNAME, PASSWORD)).json()
    repos = [Repo.from_Repository(repo) for repo in repo_response]
    return repos 
开发者ID:kshitij10496,项目名称:gh-notifier,代码行数:12,代码来源:userclass.py

示例12: from_name

# 需要导入模块: import settings [as 别名]
# 或者: from settings import PASSWORD [as 别名]
def from_name(cls, repo_name, owner_name):
        url = URL + '/repos/' + owner_name + "/" + repo_name
        # print("Repo = " + repo_name + ' : ' + url)
        repo = requests.get(url, headers=HEADERS, auth=(USERNAME, PASSWORD)).json()
        # handle pagination

        #owner = owner_name
        #name = repo_name
        #forks = repo['forks_count']
        #watchers = repo['watchers_count']
        #stars = repo['stargazers_count']
        #return cls(name, owner, forks, watchers, stars)
        return cls.from_Repository(repo) 
开发者ID:kshitij10496,项目名称:gh-notifier,代码行数:15,代码来源:repo.py


注:本文中的settings.PASSWORD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。