Ejemplo n.º 1
0
def get_api_token():
    client = upwork.Client(os.environ["upkey"], os.environ["upsecret"])
    authorize_url = client.auth.get_authorize_url()
    doc = Node(authorize_url, "url", "chrome")
    print("Navigating authorize url...")
    doc.select("#login_username").send_keys(os.getenv("email"))
    doc.select("#login_password").send_keys(os.getenv("up") + "#u")
    doc.select("#layout form").submit()

    print("Navigating token url...")
    verifier_el = doc.select("#main > div")
    verifier = first_match("(?<=oauth_verifier=).+", verifier_el.text)

    oauth_token, oauth_token_secret = client.auth.get_token(verifier)
    oauth_token = oauth_token.decode("utf-8")
    oauth_token_secret = oauth_token_secret.decode("utf-8")
    print(oauth_token, oauth_token_secret)
    return oauth_token, oauth_token_secret
Ejemplo n.º 2
0
def get_upwork_job_feed_doc():
    doc = Node(upwork_job_feed_url, Provider.PHANTOMJS)
    doc.select("#login_username").send_keys(os.getenv("email"))
    doc.select("#login_password").send_keys(os.getenv("up") + "#u")
    doc.select("#layout > div.container.ng-scope > div > form").el.submit()
    return doc
Ejemplo n.º 3
0
def get_upwork_job_feed_doc():
    doc = Node(upwork_job_feed_url, Provider.PHANTOMJS)
    doc.select("#login_username").send_keys(os.getenv("email"))
    doc.select("#login_password").send_keys(os.getenv("up") + "#u")
    doc.select("#layout > div.container.ng-scope > div > form").el.submit()
    return doc