Python settings 模块,PASSWORD 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用settings.PASSWORD

项目:mf-platform-bse    作者:utkarshohm    | 项目源码 | 文件源码
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()
项目:mf-platform-bse    作者:utkarshohm    | 项目源码 | 文件源码
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
项目:python-ossi    作者:iskhomutov    | 项目源码 | 文件源码
def __init__(self):
        #TODO: Add assertions
        self.host = settings.HOST
        self.port = settings.PORT
        self.username = settings.USERNAME
        self.password = settings.PASSWORD
        self.pin = settings.PIN
项目:GitHubFollow    作者:w568w    | 项目源码 | 文件源码
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']
项目:mf-platform-bse    作者:utkarshohm    | 项目源码 | 文件源码
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)
项目:Enibar    作者:ENIB    | 项目源码 | 文件源码
def connect(self):
        """ Connect to the database and set some parameters.
        """
        if Database.database is None:
            Database.database = QtSql.QSqlDatabase("QPSQL")
            Database.database.setHostName(os.environ.get(
                "DATABASE_HOST",
                settings.DB_HOST
            ))
            Database.database.setPort(int(os.environ.get(
                "DATABASE_PORT",
                settings.DB_PORT,
            )))
            Database.database.setUserName(os.environ.get(
                "DATABASE_USER",
                settings.USERNAME
            ))
            Database.database.setPassword(os.environ.get(
                "DATABASE_PASSWORD",
                settings.PASSWORD
            ))
            Database.database.setDatabaseName(os.environ.get(
                "DATABASE_NAME",
                settings.DBNAME
            ))
            if not Database.database.open():
                if rapi.utils.check_x11():
                    # We need this to create an app before opening a window.
                    import gui.utils
                    self.tmp = QtWidgets.QApplication(sys.argv)
                    gui.utils.error("Error", "Can't join database")
                print("Can't join database")
                sys.exit(1)
项目:micropython    作者:stlk    | 项目源码 | 文件源码
def connect():
    import network
    sta_if = network.WLAN(network.STA_IF)
    if not sta_if.isconnected():
        print('connecting to network...')
        status.violet()
        sta_if.active(True)
        sta_if.connect(SSID, PASSWORD)
        while not sta_if.isconnected():
            pass
    print('network config:', sta_if.ifconfig())
项目:strans-pyra    作者:teresinahc    | 项目源码 | 文件源码
def auth():
    """
    Authenticates the user using the url, application key,
    email and the password.

    @return: a `dict` object with the keys `token` and `minutos`,
    from json returned from the API.
    """

    global token
    endpoint = '/signin'

    url = settings.URL
    key = settings.API_KEY

    res = requests.post(
        url + endpoint,
        headers={
            'date': date(),
            'x-api-key': key,
        },
        json={
            'email': settings.EMAIL,
            'password': settings.PASSWORD
        },
        **settings.REQUEST_OPTIONS
    )

    try:
        res = res.json()
        token = res['token']
    except Exception:
        pass

    return res