#coding:utf-8
import requests
from bs4 import BeautifulSoup
import sys
import re
from jiandu.models import *
from django.conf import settings
from urllib import urlretrieve
import pandas as pd
import os
requests库
请求是一个优雅而简单的HTTP库
r = requests.get(‘https://github.com/timeline.json‘)
r为response类
通过字典传递传递参数
>>> payload = {'key1': 'value1', 'key2': 'value2'}
>>> r = requests.get("http://httpbin.org/get", params=payload)
可以指定编码(不指定为默认)来提取内容
r.encoding = 'utf-8'
r.text
r.content()#二进制响应内容