Esempio n. 1
0
def get_auth_token():
    from common import robot
    config = robot.read_config(os.path.join(os.getcwd(), "..\\common\\config.ini"))
    # 操作系统&浏览器
    browser_type = robot.get_config(config, "BROWSER_TYPE", 2, 1)
    # cookie
    is_auto_get_cookie = robot.get_config(config, "IS_AUTO_GET_COOKIE", True, 4)
    if is_auto_get_cookie:
        cookie_path = robot.tool.get_default_browser_cookie_path(browser_type)
    else:
        cookie_path = robot.get_config(config, "COOKIE_PATH", "", 0)
    return tool.get_cookie_value_from_browser("auth_token", cookie_path, browser_type, (".twitter.com",))
Esempio n. 2
0
def set_session_id():
    global SESSION_ID
    from common import robot
    config = robot.read_config(os.path.join(os.getcwd(), "..\\common\\config.ini"))
    # 操作系统&浏览器
    browser_type = robot.get_config(config, "BROWSER_TYPE", 2, 1)
    # cookie
    is_auto_get_cookie = robot.get_config(config, "IS_AUTO_GET_COOKIE", True, 4)
    if is_auto_get_cookie:
        cookie_path = robot.tool.get_default_browser_cookie_path(browser_type)
    else:
        cookie_path = robot.get_config(config, "COOKIE_PATH", "", 0)
    session_id = tool.get_cookie_value_from_browser("sessionid", cookie_path, browser_type, ("instagram.com",))
    if session_id:
        SESSION_ID = session_id