import requests
import webbrowser
#传入 requests.get() 功能. 然后我们还能用 python (webbrowser模块) 打开一个你的默认浏览器, 观看你是否在百度的搜索#页面.
param = {"wd": "莫烦Python"} # 搜索的信息
r = requests.get('http://www.baidu/s', params=param)
print(r.url)
webbrowser.open(r.url)
payload = {'username': 'Morvan', 'password': 'password'}
r = requests.post('http://pythonscraping/pages/cookies/welcome.php', data=payload)
print(r.cookies.get_dict())
# {'username': 'Morvan', 'loggedin': '1'}
r = requests.get('http://pythonscraping/pages/cookies/profile.php', cookies=r.cookies)
print(r.text)
# Hey Morvan! Looks like you're still logged into the site!
#如果你留意观察 url, 你会发现,
import requests
import webbrowser
#传入 requests.get() 功能. 然后我们还能用 python (webbrowser模块) 打开一个你的默认浏览器, 观看你是否在百度的搜索#页面.
param = {"wd": "莫烦Python"} # 搜索的信息
r = requests.get('http://www.baidu/s', params=param)
print(r.url)
webbrowser.open(r.url)
payload = {'username': 'Morvan', 'password': 'password'}
r = requests.post('http://pythonscraping/pages/cookies/welcome.php', data=payload)
print(r.cookies.get_dict())
# {'username': 'Morvan', 'loggedin': '1'}
r = requests.get('http://pythonscraping/pages/cookies/profile.php', cookies=r.cookies)
print(r.text)
# Hey Morvan! Looks like you're still logged into the site!
#如果你留意观察 url, 你会发现,