[Python] first lesson reptiles

What is the purpose of learning reptiles?

My current understanding is that reptile and get access to bulk data, for example, I want to analyze changes in house prices around, and then I need to periodically crawling the latest house price data relating to real estate website.

 

Look at the following code

import requests #import requests包
url = 'http://www.baidu.com'
resp = requests.get(url)
print(resp) #返回<Response [200]>

 If it is white, may have the following questions

What 1. url that?

2. requests.get (url) This step what happened?

3. Return <Response [200]> What is?

I think there needs to be temporarily out of Python, we recommended to see "how the network is connected," this book

What 1. url that?

URL entered by the user in the browser, that url. "Http:" represents the use http protocol to access the web server, "www.baidu.com" that is needed to access the web server name www.baidu.com omitted here to access a specific file, the default is index.html

2. requests.get (url) This step what happened?

Generates an HTTP request message requires two elements: access to the target (by parsing the url to know what the user wants to access objective is, for example, is one of Baidu picture), what action is necessary (we generally perceived to get and post method )

Skip the process of a series of message transmission request, a response message to obtain ......

3. Return <Response [200]> What is?

200 is a status code indicating that the request has been successful, the request or response header desired data volume will vary with the response returns.

 

Guess you like

Origin www.cnblogs.com/break03/p/11566886.html