Python Request error, solve!

tags: Python learning  python  url

#ip home place, IP138 website

import requests
url="https://www.ip138.com/iplookup.asp?ip="
url1="&action=2"
r=requests.get(url+'202.99.199.141'+url1)
print(r.status_code)
#r.raise_for_status()
r.encoding=r.apparent_encoding
print(r.text[-500:])

The small section of the code is wrong, you can't get the result, ask your big resolution! Thanks!
Learn strong national

Intelligent Recommendation

Solve the Spring submission file error The current request is not a multipart request

problem Java submission file error: Solution Add from enctype="multipart/form-data" to from Code reference...

Solve springMVC file upload error: The current request is not a multipart request

Solve springMVC file upload error: The current request is not a multipart request 1. Problem description When using springMVC to upload files, the page reports an error when clicking "Import"...

Python: Fastapi error with a request 422

Problem Description: I am building a simple API to test the database. When I use Get Request, everything is normal, but if I change to post, I will receive a "unprepared entity" error: This ...

More Recommendation

Python Request SSL Error 403 Certificate Error

requests.exceptions.SSLError: HTTPSConnectionPool(host='xx.xx.xx.xx', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] cert...

Solve error HTTP Error 400. The request hostname is invalid.

description Bloggers run their own projects locally, then node.js written on another server a stand-alone program, calls the interface of the local projects within the program, found in the finished c...

Solve Python 3.6, send POST request error prompt: POST data should be bytes, an iterable of bytes, or a file object. It canno

The pit I encountered before, I encountered it again today, record it here, When crawling, when transcoding data, the following error message appears: POST data should be bytes, an iterable of bytes, ...

Solve the timeout problem of python installation package request

Example: pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. Solution: just replace the network Or try to set:...

Solve python pip request timeout problem

The pip request timeout solution: The first type, the pip version is updated, enter If the first update is completed or the request times out, proceed to the second: Switch source Switch the source to...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top