Python settings.PASSWORD Examples
The following are 12
code examples of settings.PASSWORD().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
settings
, or try the search function
.
Example #1
Source File: face_query.py From face-search with MIT License | 6 votes |
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
Example #2
Source File: api.py From mf-platform-bse with MIT License | 6 votes |
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()
Example #3
Source File: api.py From mf-platform-bse with MIT License | 6 votes |
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
Example #4
Source File: face_query.py From face-search with MIT License | 5 votes |
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
Example #5
Source File: db.py From face-search with MIT License | 5 votes |
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()
Example #6
Source File: face.py From face-search with MIT License | 5 votes |
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)
Example #7
Source File: web.py From mf-platform-bse with MIT License | 5 votes |
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)
Example #8
Source File: main.py From GitHubFollow with GNU General Public License v3.0 | 5 votes |
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']
Example #9
Source File: userclass.py From gh-notifier with MIT License | 5 votes |
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
Example #10
Source File: userclass.py From gh-notifier with MIT License | 5 votes |
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
Example #11
Source File: userclass.py From gh-notifier with MIT License | 5 votes |
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
Example #12
Source File: repo.py From gh-notifier with MIT License | 5 votes |
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)