萌新求问爬虫第一步
求问各位大佬们,我想从0开始学习爬虫,找了一个帖子https://www.cnblogs.com/www1707/p/10692298.html他里面有个URL:https://wordpress-edu-3autumn.localprod.forc.work/all-about-the-future_04/
我打不开这个URL,求问通过什么途径可以打开吗 本帖最后由 suchocolate 于 2020-6-30 20:15 编辑
是这个网站的问题,无法登陆,你换其他网址练习,比如:http://httpbin.org
1)get练习
import requests
headers={'User-Agent': 'Mozilla/5.0'}
r=requests.get('http://httpbin.org/get',headers=headers)
print('status code is ' + str(r.status_code))
print(r.text)
2)post练习
import requests
headers={'User-Agent': 'Mozilla/5.0'}
data={
'name': 'suchocolate',
'time': '20190103'
}
r=requests.post('http://httpbin.org/post', data=data, headers=headers)
print('status code is ' + str(r.status_code))
print(r.text)
另外系统学习爬虫还是买本书,网上的查查特殊使用还可以,爬虫遵循一定的规律和方法,网上东一块西一块可能会误导你,耽误时间。
页:
[1]