百度360キーワードの提出
2663 ワード
import requests
def main(url):
try:
params = {
'kv':'Python'} # , ,
resp = requests.get(url, params = params) #params
resp.raise_for_status()
print(resp.request.url)
resp.encoding = resp.apparent_encoding # encoding ,apparent_encoding
print(len(resp.text))
return resp.text
except:
return ' '
if __name__ == '__main__':
url = 'http://www.baidu.com/s'
print(main(url))