Soumettre la recherche
Mettre en ligne
Communication with python_http_module
•
0 j'aime
•
512 vues
D
dreampuf
Suivre
Introduction the python module used for in request of URL is Restful API
Lire moins
Lire la suite
Technologie
Signaler
Partager
Signaler
Partager
1 sur 19
Recommandé
Autorelease pool
Autorelease pool
Michael Pan
Git初步入門
Git初步入門
recast203
Mysql展示功能与源码对应
Mysql展示功能与源码对应
zhaolinjnu
Drag & drop
Drag & drop
Alibaba Group
Mvc
Mvc
tbmallf2e
D2 如何发现前端性能问题
D2 如何发现前端性能问题
aoao
Python包管理工具介绍
Python包管理工具介绍
Young King
Web crawler - Scrapy
Web crawler - Scrapy
yafish
Recommandé
Autorelease pool
Autorelease pool
Michael Pan
Git初步入門
Git初步入門
recast203
Mysql展示功能与源码对应
Mysql展示功能与源码对应
zhaolinjnu
Drag & drop
Drag & drop
Alibaba Group
Mvc
Mvc
tbmallf2e
D2 如何发现前端性能问题
D2 如何发现前端性能问题
aoao
Python包管理工具介绍
Python包管理工具介绍
Young King
Web crawler - Scrapy
Web crawler - Scrapy
yafish
Puppet的使用与管理
Puppet的使用与管理
Elain Ding
Java soap
Java soap
accontra
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
Yang FaFa
快快樂樂學 Scrapy
快快樂樂學 Scrapy
recast203
Google IoT Core 初體驗
Google IoT Core 初體驗
Simon Su
輕輕鬆鬆用 Nodejs 寫網路爬蟲
輕輕鬆鬆用 Nodejs 寫網路爬蟲
傑倫 鍾
Day16. Ktor Exposed - DAO
Day16. Ktor Exposed - DAO
舒安 楊
Day17. Ktor Exposed - DSL 實作 #將聊天機器人收到的訊息,寫入Ktor的資料庫吧~
Day17. Ktor Exposed - DSL 實作 #將聊天機器人收到的訊息,寫入Ktor的資料庫吧~
舒安 楊
Shell奇技淫巧
Shell奇技淫巧
David Xie
Node.js從無到有 基本課程
Node.js從無到有 基本課程
Simon Su
Dive into kissy
Dive into kissy
jay li
MySQL aio
MySQL aio
zhaolinjnu
Websocket
Websocket
fangdeng
資料庫應用與實際操作
資料庫應用與實際操作
阿狗 郭
Log analytics
Log analytics
itseo
The introduction of data visualization
The introduction of data visualization
dreampuf
Python client api
Python client api
dreampuf
Refactoring
Refactoring
dreampuf
Python magicmethods
Python magicmethods
dreampuf
Machine learning share No.1
Machine learning share No.1
dreampuf
Python profiling
Python profiling
dreampuf
A short introduction of D3js
A short introduction of D3js
dreampuf
Contenu connexe
Tendances
Puppet的使用与管理
Puppet的使用与管理
Elain Ding
Java soap
Java soap
accontra
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
Yang FaFa
快快樂樂學 Scrapy
快快樂樂學 Scrapy
recast203
Google IoT Core 初體驗
Google IoT Core 初體驗
Simon Su
輕輕鬆鬆用 Nodejs 寫網路爬蟲
輕輕鬆鬆用 Nodejs 寫網路爬蟲
傑倫 鍾
Day16. Ktor Exposed - DAO
Day16. Ktor Exposed - DAO
舒安 楊
Day17. Ktor Exposed - DSL 實作 #將聊天機器人收到的訊息,寫入Ktor的資料庫吧~
Day17. Ktor Exposed - DSL 實作 #將聊天機器人收到的訊息,寫入Ktor的資料庫吧~
舒安 楊
Shell奇技淫巧
Shell奇技淫巧
David Xie
Node.js從無到有 基本課程
Node.js從無到有 基本課程
Simon Su
Dive into kissy
Dive into kissy
jay li
MySQL aio
MySQL aio
zhaolinjnu
Websocket
Websocket
fangdeng
資料庫應用與實際操作
資料庫應用與實際操作
阿狗 郭
Log analytics
Log analytics
itseo
Tendances
(15)
Puppet的使用与管理
Puppet的使用与管理
Java soap
Java soap
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
快快樂樂學 Scrapy
快快樂樂學 Scrapy
Google IoT Core 初體驗
Google IoT Core 初體驗
輕輕鬆鬆用 Nodejs 寫網路爬蟲
輕輕鬆鬆用 Nodejs 寫網路爬蟲
Day16. Ktor Exposed - DAO
Day16. Ktor Exposed - DAO
Day17. Ktor Exposed - DSL 實作 #將聊天機器人收到的訊息,寫入Ktor的資料庫吧~
Day17. Ktor Exposed - DSL 實作 #將聊天機器人收到的訊息,寫入Ktor的資料庫吧~
Shell奇技淫巧
Shell奇技淫巧
Node.js從無到有 基本課程
Node.js從無到有 基本課程
Dive into kissy
Dive into kissy
MySQL aio
MySQL aio
Websocket
Websocket
資料庫應用與實際操作
資料庫應用與實際操作
Log analytics
Log analytics
En vedette
The introduction of data visualization
The introduction of data visualization
dreampuf
Python client api
Python client api
dreampuf
Refactoring
Refactoring
dreampuf
Python magicmethods
Python magicmethods
dreampuf
Machine learning share No.1
Machine learning share No.1
dreampuf
Python profiling
Python profiling
dreampuf
A short introduction of D3js
A short introduction of D3js
dreampuf
The Outcome Economy
The Outcome Economy
Helge Tennø
En vedette
(8)
The introduction of data visualization
The introduction of data visualization
Python client api
Python client api
Refactoring
Refactoring
Python magicmethods
Python magicmethods
Machine learning share No.1
Machine learning share No.1
Python profiling
Python profiling
A short introduction of D3js
A short introduction of D3js
The Outcome Economy
The Outcome Economy
Communication with python_http_module
1.
Communication with
python HTTP module dreampuf , jul 2012 12年7月6日星期五
2.
introduction
urllib2.urlopen("http://www.guokr.com") 12年7月6日星期五
3.
introduction
Pyt hon GC :( urllib2.urlopen("http://www.guokr.com").read() 12年7月6日星期五
4.
introduction
fd = urllib2.urlopen(“http://www.guokr.com”) print fd.read() fd.close() 12年7月6日星期五
5.
introduction
with contextlib.closing(urllib2.urlopen("URL")) as f: print f.read() 12年7月6日星期五
6.
introduction
import contextlib import urllib2 with contextlib.closing(urllib2.urlopen("URL")) as f: print f.read() 12年7月6日星期五
7.
introduction
Pyt hon 2.5 from __futrure__ import with_statement :) import contextlib import urllib2 with contextlib.closing(urllib2.urlopen("URL")) as f: print f.read() 12年7月6日星期五
8.
introduction cj =
cookielib.LWPCookieJar() cookie_support = urllib2.HTTPCookieProcessor(cj) opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler) urllib2.install_opener(opener) Build postdata = urllib.urlencode(postdata) headers = {'User-Agent':'Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0'} req = urllib2.Request( url = url, data = postdata, headers = headers ) result = urllib2.urlopen(req) Send text = result.read() 12年7月6日星期五
9.
agenda
urllib2 httplib2 pycurl requests 12年7月6日星期五
10.
Mission
Post https://api.github.com/user/repos With some data And our credentials 12年7月6日星期五
11.
Urllib2 12年7月6日星期五
12.
httplib2 12年7月6日星期五
13.
httplib2
urllib2 - The Missing Manual: HOWTO Fetch Internet Resources with Python www-authenticate: SCHEME realm="REALM" 12年7月6日星期五
14.
httplib2 Basic Authentication
Process 1.Client -> Server Get /index.html HTTP/1.0 Host:www.google.com 2.Server -> Client HTTP/1.0 401 Unauthorised Server: nginx/1.0.13 WWW-‐AuthenBcate: Basic realm="github.com" Content-‐Type: text/html Content-‐Length: xxx 3.Client -> Server Get /index.html HTTP/1.0 Host:www.google.com AuthorizaBon: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxx 12年7月6日星期五
15.
httplib2 12年7月6日星期五
16.
pycurl 12年7月6日星期五
17.
requests 12年7月6日星期五
18.
Thank you ! 12年7月6日星期五
19.
reference •GitHub
Document v3 #create http://developer.github.com/v3/repos/#create •Restful API in Python http://isbullsh.it/2012/06/Rest-api-in-python/ •urllib2 - The Missing Manual http://www.voidspace.org.uk/python/articles/urllib2.shtml#id6 •HTTP使用BASIC认证的原理及实现方法 http://space.itpub.net/23071790/viewspace-709367 12年7月6日星期五