17 lines
316 B
Python
17 lines
316 B
Python
import requests
|
|
|
|
|
|
def get_HTML_Text():
|
|
try:
|
|
r = requests.get(url, timeout=30)
|
|
r.raise_for_status()
|
|
r.encoding = r.apparent_encoding
|
|
return r.text
|
|
except:
|
|
print("异常")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
url = "https://www.jd.com/robots.txt"
|
|
print(get_HTML_Text())
|