【实例简介】
requests是python的一个HTTP客户端库,跟urllib,urllib2类似,那为什么要用requests而不用urllib2呢?官方文档中是这样说明的:“ python的标准库urllib2提供了大部分需要的HTTP功能,但是API太逆天了,一个简单的功能就需要一大堆代码。”
【实例截图】
【核心代码】
requests-master
└── requests-master
├── AUTHORS.rst
├── HISTORY.rst
├── LICENSE
├── MANIFEST.in
├── Makefile
├── NOTICE
├── README.rst
├── docs
│ ├── MANIFEST.in
│ ├── Makefile
│ ├── _static
│ │ └── requests-sidebar.png
│ ├── _templates
│ │ ├── sidebarintro.html
│ │ └── sidebarlogo.html
│ ├── _themes
│ │ ├── LICENSE
│ │ ├── README.rst
│ │ ├── flask_theme_support.py
│ │ ├── kr
│ │ │ ├── layout.html
│ │ │ ├── relations.html
│ │ │ ├── static
│ │ │ │ └── flasky.css_t
│ │ │ └── theme.conf
│ │ └── kr_small
│ │ ├── layout.html
│ │ ├── static
│ │ │ └── flasky.css_t
│ │ └── theme.conf
│ ├── api.rst
│ ├── community
│ │ ├── faq.rst
│ │ ├── out-there.rst
│ │ ├── support.rst
│ │ └── updates.rst
│ ├── conf.py
│ ├── dev
│ │ ├── authors.rst
│ │ ├── internals.rst
│ │ ├── philosophy.rst
│ │ └── todo.rst
│ ├── index.rst
│ ├── make.bat
│ ├── requirements.txt
│ └── user
│ ├── advanced.rst
│ ├── authentication.rst
│ ├── install.rst
│ ├── intro.rst
│ └── quickstart.rst
├── ext
│ └── requests-logo.ai
├── requests
│ ├── __init__.py
│ ├── adapters.py
│ ├── api.py
│ ├── auth.py
│ ├── cacert.pem
│ ├── certs.py
│ ├── compat.py
│ ├── cookies.py
│ ├── exceptions.py
│ ├── hooks.py
│ ├── models.py
│ ├── packages
│ │ ├── README.rst
│ │ ├── __init__.py
│ │ ├── chardet
│ │ │ ├── __init__.py
│ │ │ ├── big5freq.py
│ │ │ ├── big5prober.py
│ │ │ ├── chardetect.py
│ │ │ ├── chardistribution.py
│ │ │ ├── charsetgroupprober.py
│ │ │ ├── charsetprober.py
│ │ │ ├── codingstatemachine.py
│ │ │ ├── compat.py
│ │ │ ├── constants.py
│ │ │ ├── cp949prober.py
│ │ │ ├── escprober.py
│ │ │ ├── escsm.py
│ │ │ ├── eucjpprober.py
│ │ │ ├── euckrfreq.py
│ │ │ ├── euckrprober.py
│ │ │ ├── euctwfreq.py
│ │ │ ├── euctwprober.py
│ │ │ ├── gb2312freq.py
│ │ │ ├── gb2312prober.py
│ │ │ ├── hebrewprober.py
│ │ │ ├── jisfreq.py
│ │ │ ├── jpcntx.py
│ │ │ ├── langbulgarianmodel.py
│ │ │ ├── langcyrillicmodel.py
│ │ │ ├── langgreekmodel.py
│ │ │ ├── langhebrewmodel.py
│ │ │ ├── langhungarianmodel.py
│ │ │ ├── langthaimodel.py
│ │ │ ├── latin1prober.py
│ │ │ ├── mbcharsetprober.py
│ │ │ ├── mbcsgroupprober.py
│ │ │ ├── mbcssm.py
│ │ │ ├── sbcharsetprober.py
│ │ │ ├── sbcsgroupprober.py
│ │ │ ├── sjisprober.py
│ │ │ ├── universaldetector.py
│ │ │ └── utf8prober.py
│ │ └── urllib3
│ │ ├── __init__.py
│ │ ├── _collections.py
│ │ ├── connection.py
│ │ ├── connectionpool.py
│ │ ├── contrib
│ │ │ ├── __init__.py
│ │ │ ├── ntlmpool.py
│ │ │ └── pyopenssl.py
│ │ ├── exceptions.py
│ │ ├── fields.py
│ │ ├── filepost.py
│ │ ├── packages
│ │ │ ├── __init__.py
│ │ │ ├── ordered_dict.py
│ │ │ ├── six.py
│ │ │ └── ssl_match_hostname
│ │ │ ├── __init__.py
│ │ │ └── _implementation.py
│ │ ├── poolmanager.py
│ │ ├── request.py
│ │ ├── response.py
│ │ └── util.py
│ ├── sessions.py
│ ├── status_codes.py
│ ├── structures.py
│ └── utils.py
├── requirements.txt
├── setup.cfg
├── setup.py
└── test_requests.py
20 directories, 119 files