小编Ant*_*ony的帖子

获取奇怪的连接会中断python请求的错误

import json
import string
import socket
import requests
from bs4 import BeautifulSoup

# Default header to be used first.
headers={"User-Agent": "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"}

# Create a session using requests to log in.
with requests.Session() as s:
    # Grab new headers and cookies from login page
    t = s.get("http://minewind.com/forums/ucp.php?mode=login", headers=headers)

    sid = t.cookies['phpbb3_qpac2_sid'] # Store sid to be used in POST data.


    # POST data to be sent
    payload = {"login": "Login", …
Run Code Online (Sandbox Code Playgroud)

python python-requests

6
推荐指数
1
解决办法
7501
查看次数

标签 统计

python ×1

python-requests ×1