← 输入框|github.com|刷新
Skip to content

Doesn't work. I changed to random dest_ip and got the same result (in python 2) #10

Open

Description

@ndvbd

Doesn't work. I changed to random dest_ip and got the same result (in python 2)

Activity

  1. amarao commented on Jun 30, 2022

    @amarao

    https://pythonclock.org/

    I believe now is a year 2022, and python2 is dead for two years already.

    You have three options:

    1. Switch to python 3
    2. Ask your vendor to support you on this case (if you have payed supported version of python2, it's their problem now)
    3. Fix this yourself.
  2. ndvbd commented on Jul 3, 2022

    @ndvbd
    Author

    I tried in python 3. When I run this code:

    import requests from forcediphttpsadapter.adapters import ForcedIPHTTPSAdapter session = requests.Session() session.mount("https://cnn.com", ForcedIPHTTPSAdapter(dest_ip='151.101.1.67')) response = session.get('https://cnn.com', headers={'Host': 'cnn.com'}, verify=False) print(response.text[:150])

    I get infinite loop of thee prints:

    /usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning) /usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning) /usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning)

    What am I doing wrong?

  3. amarao commented on Jul 4, 2022

    @amarao

    It's warnings. They should not affect the code. If it's broken, that's for different reason.

    You can disable them by googling InsecureRequestWarning or reading https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions