psf / requests

A simple, yet elegant, HTTP library.
https://requests.readthedocs.io/en/latest/
Apache License 2.0
52.17k stars 9.33k forks source link

[bug]requests isn't work when meets too long url,what can i do? #5568

Closed ch-boogeyman closed 4 years ago

ch-boogeyman commented 4 years ago

Summary.

Expected Result

What you expected.

Actual Result

What happened instead. When i am crawling a web,I meet a long url.it returned me a wrong result. So i used fiddler to check what happen,it showed the url not complete. How can i resolve it? lose code

Reproduction Steps

import requests
import time

    url = 'https://ifm.zhaobenshu.com/User/user_ifa_LoginCard.ashx?a=[Lib={{gdut}}][OpenId={{}}][PmWebApiProxy={{}}][UrlQsLib={{#}}][Opac={{sulcmis4}}][OpacCaptcha={{0}}][UrlHost={{http://gdut.n1.zhaobenshu.com/}}][CardId={{' + \
        req['account'] + '}}][CardPwd={{' + req['pwd'] + \
        '}}][UniSess={{}}][SessLib={{gdut}}][SessFun={{wap}}][SessPrd={{reso}}][CookiesStr={{}}][CaptchaStr={{}}]&x=&y=01&z=&_=' + \
        str(int(round(time.time() * 1000)))
    res = requests.get(url)

System Information

$ python -m requests.help
{
  "chardet": {
    "version": "3.0.4"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "2.8"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.8.3"
  },
  "platform": {
    "release": "10",
    "system": "Windows"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.22.0"
  },
  "system_ssl": {
    "version": "1010106f"
  },
  "urllib3": {
    "version": "1.25.8"
  },
  "using_pyopenssl": false
}

This command is only available on Requests v2.16.4 and greater. Otherwise, please provide some basic information about your system (Python version, operating system, &c).

ch-boogeyman commented 4 years ago

My url has a '#',we should replace it to empty.