第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

使用請求登錄 - 不知道在哪里發(fā)布

使用請求登錄 - 不知道在哪里發(fā)布

慕慕森 2021-11-16 16:16:33
我完全無法登錄此頁面:https://login.wyborcza.pl/我試過這個(gè)解決方案:import requests# Fill in your details here to be posted to the login form.payload = {    'name': 'username',    'pass': 'password'}# Use 'with' to ensure the session context is closed after use.with requests.Session() as s:    login_url = "https://login.wyborcza.pl/"    p = s.post(login_url, data=payload)    # print the html returned or something more intelligent to see if it's a successful login page.    print p.text    # the authorised request.    r = s.get('A protected web page url')    print r.text    # etc...我在這里找到的,但我只得到一個(gè)400狀態(tài)。謝謝閱讀。更新:出現(xiàn)另一個(gè)問題:當(dāng)我嘗試使用 request.get() 在此頁面中閱讀時(shí),我收到一條消息,提示已啟用廣告攔截器,但未加載頁面內(nèi)容。但是,如果我嘗試在瀏覽器中訪問該頁面,則沒有問題 - 所有內(nèi)容都已加載。import requests# Fill in your details here to be posted to the login form.payload = {    'username': 'username',    'password': 'password'}# Use 'with' to ensure the session context is closed after use.with requests.Session() as s:    login_url = "https://login.wyborcza.pl/services/ajax/wyborcza/login"    p = s.post(login_url, data=payload)    # print the html returned or something more intelligent to see if it's a successful login page.    cookiesALL = s.cookies.get_dict()
查看完整描述

1 回答

?
智慧大石

TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超3個(gè)贊

此腳本應(yīng)該可以解決您的問題:


import requests


# Fill in your details here to be posted to the login form.

payload = {

    'username': 'username',

    'password': 'password'

}


# Use 'with' to ensure the session context is closed after use.

with requests.Session() as s:

    login_url = "https://login.wyborcza.pl/services/ajax/wyborcza/login"

    p = s.post(login_url, data=payload)

    # print the html returned or something more intelligent to see if it's a successful login page.

    cookiesALL = s.cookies.get_dict()


    s.headers.update({

        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0",

        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",

        "Accept-Language": "en-US,en;q=0.5",

        "Accept-Encoding": "gzip, deflate",

        "DNT": "1",

        "Connection": "close",

        "Upgrade-Insecure-Requests": "1",

        "Cookie":"SsoSessionPermanent={}; GW_SID=220D44FAAD9071FAC49796195720D348.tomwybo17; ag-rd-params=; __gfp_64b=-TURNEDOFF; customDataLayer_customer=%7B%22state%22%3A%22anonymous%22%2C%22validPeriod%22%3A%22%22%7D; bwGuidv2=b952c7409c97c249520c9e8a; SquidLocalUID=3c9df34214b0a589cf4863b7; wyborczaXYZ=test; test=131A251A253A104k1550911251283; bwVisitId=f5a2c74d1ba13dfde8d36c40".format(cookiesALL['SsoSessionPermanent'])

    })

    # the authorised request.

    r = s.get('https://wyborcza.pl/1,76842,3360710.html')

    print(r.text)

    # etc...

您正在處理的問題與您錯(cuò)誤的參數(shù)名稱(在payloads)以及l(fā)ogin_url您向其發(fā)送 POST 請求有關(guān)。



查看完整回答
反對 回復(fù) 2021-11-16
  • 1 回答
  • 0 關(guān)注
  • 201 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號