Python-requests
python-requests
#pythonrequests
Table of Contents
About
1
Chapter 1: Getting started with python-requests
2
Remarks
2
HTTP for Humans
2
Examples
2
Installation or Setup
2
GET requests
3
POST requests
3
Other request methods
3
Reading the response
4
Reading status codes
4
Chapter 2: Automating login using Requests over Single Sign On
5
Examples
5
Example of accessing authenticated pages using requests
5
Chapter 3: Django Framework
7
Examples
7
Installation & Setup
7
Django Core Concepts
7
Core Concepts - Views
8
Core Concepts - Templates
8
Core Concepts - URLs
9
Chapter 4: Files
10
Parameters
10
Remarks
10
Examples
10
Simple File Upload
10
File Upload w/ Manual Params
10
Sending Strings as FIles
10
Chapter 5: Sending and receiving JSON
11
Examples
11
POSTing JSON
11
Receiving JSON in a response
11
ETL from web API's with modules json and requests
11
Chapter 6: Using requests behind a proxy
14
Examples
14
Setting proxy in Python code
14
Using proxy environment variables
14
Credits
15
About
You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: python-requests
It is an unofficial and free python-requests ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official python-requests.
The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.
Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to info@
1
Chapter 1: Getting started with pythonrequests
Remarks
HTTP for Humans
Requests is the only Non-GMO HTTP library for Python, safe for human consumption.
Requests allows you to send organic, grass-fed HTTP/1.1 requests, without the need for manual labor. There's no need to manually add query strings to your URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling are 100% automatic, powered by urllib3, which is embedded within Requests.
The power of Requests:
>>> r = requests.get('', auth=('user', 'pass')) >>> r.status_code 200 >>> r.headers['content-type'] 'application/json; charset=utf8' >>> r.encoding 'utf-8' >>> r.text u'{"type":"User"...' >>> r.json() {u'private_gists': 419, u'total_private_repos': 77, ...}
Examples
Installation or Setup
python-requests is available on PyPI, the Python Package Index, which means it can be installed through pip:
pip install requests
Up-to-date source code can be found on the requests GitHub repository
If you wish to install it from source, you can do this by either cloning the GitHub repository:
git clone git://kennethreitz/requests.git
Or by getting the tarball (-O writes the output to file; -L follows redirects):
2
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- python requests get example
- python requests post form data
- python requests send form data
- python requests send file
- python requests post file
- python requests post file upload
- python requests multipart form
- python requests post file multipart
- python requests json example
- python requests get content
- python requests https
- python requests post