目录
Requests: 最友好的网络爬虫功能库,http://www.python-requests.org/
import requests
r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
r.status_code
r.headers['content-type']
r.encoding
r.text
Scrapy: 优秀的网络爬虫框架,Python数据分析高层次应用库,https://scrapy.org
pyspider: 强大的Web页面爬取系统,http://docs.pyspider.org
Beautiful Soup: HTML和XML的解析库,https://www.crummy.com/software/BeautifulSoup/bs4
Re: 正则表达式解析和处理功能库,https://docs.python.org/3.6/library/re.html
Python-Goose: 提取文章类型Web页面的功能库,https://github.com/grangier/python-goose
from goose import Goose
url = 'http://www.elmundo.es/elmundo/2012/10/28/espana/1351388909.html'
g = Goose({'use_meta_language': False,'target_language':'es'})
article = g.extract(url=url)
article.cleaned_text[:150]
Django: 最流行的Web应用框架,https://www.djangoproject.com
Pyramid: 规模适中的Web应用框架,https://trypyramid.com/
# 10行左右Hello Word程序
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
return Response('Hello World')
if __name__ == '__main__':
with Configurator() as config:
config.add_route('hello', '/')
config.add_view(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever()
Flask: Web应用开发微框架,http://flask.pocoo.org
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
WeRoBot: 微信公众号开发框架,https://github.com/offu/WeRoBot
# 对微信每个消息反馈一个Hello World
import werobot
robot = werobot.WeRoBot(token='tokenhere')
@robot.handler
def hello(message):
return 'Hello World!'
aip: 百度AI开放平台接口,https://github.com/offu/WeRoBot
MyQR: 二维码生成第三方库,https://github.com/sylnsfar/qrcode
原文:https://www.cnblogs.com/nickchen121/p/11219400.html