From ed72cba49248fa51f5787d4a2c19f36297a9ee5f Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Tue, 28 Aug 2012 12:19:28 -0400 Subject: Fixes issue #212. Fixes issue #210. Fixes issue #214. Fixes issue #223. Fixes issue #222. --- CHANGELOG | 19 + doc/html/_sources/libhttplib2.txt | 2 +- doc/html/_static/basic.css | 137 +- doc/html/_static/default.css | 54 +- doc/html/_static/doctools.js | 59 +- doc/html/_static/jquery.js | 4520 +++++++++++++++++++++++++++++++++++-- doc/html/_static/pygments.css | 123 +- doc/html/_static/searchtools.js | 193 +- doc/html/genindex.html | 346 +-- doc/html/index.html | 104 +- doc/html/libhttplib2.html | 276 +-- doc/html/modindex.html | 2 +- doc/html/objects.inv | Bin 667 -> 1810 bytes doc/html/search.html | 38 +- doc/html/searchindex.js | 2 +- doc/libhttplib2.rst | 2 +- python2/httplib2/__init__.py | 17 +- python3/httplib2/__init__.py | 12 +- setup.py | 2 +- 19 files changed, 4846 insertions(+), 1062 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4aaf05d..a2d9cbd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,22 @@ +0.7.5 + Keys are lowercase in a Response object, regardless of how Response object is constructed. + Add control so that Authorization: headers aren't forwarded on a 3xx response by default. + Set the reason correctly when running on App Engine. Patch from Alain Vongsouvanh. Reviewed in http://codereview.appspot.com/6422051/ + Fix proxy socks for SSL connections. Fixes issue #199. + You can now set httplib2.RETRIES to the number of retries before a request + is considered to fail It is set to a default of 2 to mimic the traditional + behavior of httplib2. + + The following issues have been addressed: + + 223 HEAD requests fail calling the close() method of ResponseDict instance. + 222 Can't disable cert validation in appengine + 204 Credentials can leak in HTTP redirects + 210 Different API between Python 2 and Python 3 version breaks wsgi_intercept + 214 ValueError on malformated cache entries + 204 Credentials can leak in HTTP redirects + + 0.7.3 ProxyInfo objects now can construct themselves from environment variables commonly-used in Unix environments. By default, the Http diff --git a/doc/html/_sources/libhttplib2.txt b/doc/html/_sources/libhttplib2.txt index fc72bbf..d8e33d0 100644 --- a/doc/html/_sources/libhttplib2.txt +++ b/doc/html/_sources/libhttplib2.txt @@ -193,7 +193,7 @@ code indicating an error occured. See .. % type name like methoddesc. -.. class:: Http([cache=None], [timeout=None], [proxy_info=None], [ca_certs=None], [disable_ssl_certificate_validation=False]) +.. class:: Http([cache=None], [timeout=None], [proxy_info==ProxyInfo.from_environment], [ca_certs=None], [disable_ssl_certificate_validation=False]) The class that represents a client HTTP interface. The *cache* parameter is either the name of a directory to be used as a flat file cache, or it must an diff --git a/doc/html/_static/basic.css b/doc/html/_static/basic.css index f0379f3..a04d654 100644 --- a/doc/html/_static/basic.css +++ b/doc/html/_static/basic.css @@ -1,12 +1,6 @@ -/* - * basic.css - * ~~~~~~~~~ - * - * Sphinx stylesheet -- basic theme. - * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * +/** + * Sphinx stylesheet -- basic theme + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* -- main layout ----------------------------------------------------------- */ @@ -79,14 +73,6 @@ div.sphinxsidebar input { font-size: 1em; } -div.sphinxsidebar input[type="text"] { - width: 170px; -} - -div.sphinxsidebar input[type="submit"] { - width: 30px; -} - img { border: 0; } @@ -141,10 +127,6 @@ span.linkdescr { /* -- general index --------------------------------------------------------- */ -table.indextable { - width: 100%; -} - table.indextable td { text-align: left; vertical-align: top; @@ -170,20 +152,6 @@ img.toggler { cursor: pointer; } -div.modindex-jumpbox { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - margin: 1em 0 1em 0; - padding: 0.4em; -} - -div.genindex-jumpbox { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - margin: 1em 0 1em 0; - padding: 0.4em; -} - /* -- general body styles --------------------------------------------------- */ a.headerlink { @@ -221,36 +189,6 @@ p.rubric { font-weight: bold; } -img.align-left, .figure.align-left, object.align-left { - clear: left; - float: left; - margin-right: 1em; -} - -img.align-right, .figure.align-right, object.align-right { - clear: right; - float: right; - margin-left: 1em; -} - -img.align-center, .figure.align-center, object.align-center { - display: block; - margin-left: auto; - margin-right: auto; -} - -.align-left { - text-align: left; -} - -.align-center { - text-align: center; -} - -.align-right { - text-align: right; -} - /* -- sidebars -------------------------------------------------------------- */ div.sidebar { @@ -314,7 +252,7 @@ table.docutils { } table.docutils td, table.docutils th { - padding: 1px 8px 1px 5px; + padding: 1px 8px 1px 0; border-top: 0; border-left: 0; border-right: 0; @@ -334,37 +272,8 @@ th { padding-right: 5px; } -table.citation { - border-left: solid 1px gray; - margin-left: 1px; -} - -table.citation td { - border-bottom: none; -} - /* -- other body styles ----------------------------------------------------- */ -ol.arabic { - list-style: decimal; -} - -ol.loweralpha { - list-style: lower-alpha; -} - -ol.upperalpha { - list-style: upper-alpha; -} - -ol.lowerroman { - list-style: lower-roman; -} - -ol.upperroman { - list-style: upper-roman; -} - dl { margin-bottom: 15px; } @@ -383,7 +292,7 @@ dd { margin-left: 30px; } -dt:target, .highlighted { +dt:target, .highlight { background-color: #fbe54e; } @@ -420,7 +329,7 @@ dl.glossary dt { } .footnote:target { - background-color: #ffa; + background-color: #ffa } .line-block { @@ -435,28 +344,10 @@ dl.glossary dt { margin-left: 1.5em; } -.guilabel, .menuselection { - font-family: sans-serif; -} - -.accelerator { - text-decoration: underline; -} - -.classifier { - font-style: oblique; -} - -abbr, acronym { - border-bottom: dotted 1px; - cursor: help; -} - /* -- code displays --------------------------------------------------------- */ pre { overflow: auto; - overflow-y: hidden; /* fixes display issues on Chrome browsers */ } td.linenos pre { @@ -493,20 +384,6 @@ h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } -.viewcode-link { - float: right; -} - -.viewcode-back { - float: right; - font-family: sans-serif; -} - -div.viewcode-block:target { - margin: -1px -10px; - padding: 0 10px; -} - /* -- math display ---------------------------------------------------------- */ img.math { @@ -537,4 +414,4 @@ span.eqno { #top-link { display: none; } -} \ No newline at end of file +} diff --git a/doc/html/_static/default.css b/doc/html/_static/default.css index 21f3f50..42ed6ec 100644 --- a/doc/html/_static/default.css +++ b/doc/html/_static/default.css @@ -1,12 +1,6 @@ -/* - * default.css_t - * ~~~~~~~~~~~~~ - * - * Sphinx stylesheet -- default theme. - * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * +/** + * Sphinx stylesheet -- default theme + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @import url("basic.css"); @@ -113,27 +107,21 @@ div.sphinxsidebar input { font-size: 1em; } - - -/* -- hyperlink styles ------------------------------------------------------ */ +/* -- body styles ----------------------------------------------------------- */ a { color: #355f7c; text-decoration: none; } -a:visited { - color: #355f7c; - text-decoration: none; -} - a:hover { text-decoration: underline; } - - -/* -- body styles ----------------------------------------------------------- */ +div.body p, div.body dd, div.body li { + text-align: justify; + line-height: 130%; +} div.body h1, div.body h2, @@ -178,18 +166,6 @@ div.admonition p.admonition-title + p { display: inline; } -div.admonition p { - margin-bottom: 5px; -} - -div.admonition pre { - margin-bottom: 5px; -} - -div.admonition ul, div.admonition ol { - margin-bottom: 5px; -} - div.note { background-color: #eee; border: 1px solid #ccc; @@ -233,24 +209,10 @@ tt { font-size: 0.95em; } -th { - background-color: #ede; -} - .warning tt { background: #efc2c2; } .note tt { background: #d6d6d6; -} - -.viewcode-back { - font-family: sans-serif; -} - -div.viewcode-block:target { - background-color: #f4debf; - border-top: 1px solid #ac9; - border-bottom: 1px solid #ac9; } \ No newline at end of file diff --git a/doc/html/_static/doctools.js b/doc/html/_static/doctools.js index d4619fd..9447678 100644 --- a/doc/html/_static/doctools.js +++ b/doc/html/_static/doctools.js @@ -1,31 +1,16 @@ -/* - * doctools.js - * ~~~~~~~~~~~ - * - * Sphinx JavaScript utilities for all documentation. - * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -/** - * select a different prefix for underscore - */ -$u = _.noConflict(); +/// XXX: make it cross browser /** * make the code below compatible with browsers without * an installed firebug like debugger + */ if (!window.console || !console.firebug) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", - "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", - "profile", "profileEnd"]; + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {}; + window.console[names[i]] = function() {} } - */ /** * small helper function to urldecode strings @@ -59,7 +44,7 @@ jQuery.getQueryParameters = function(s) { result[key] = [value]; } return result; -}; +} /** * small function to check if an array contains @@ -71,7 +56,7 @@ jQuery.contains = function(arr, item) { return true; } return false; -}; +} /** * highlight a given string on a jquery object by wrapping it in @@ -82,7 +67,7 @@ jQuery.fn.highlightText = function(text, className) { if (node.nodeType == 3) { var val = node.nodeValue; var pos = val.toLowerCase().indexOf(text); - if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { + if (pos >= 0 && !jQuery.className.has(node.parentNode, className)) { var span = document.createElement("span"); span.className = className; span.appendChild(document.createTextNode(val.substr(pos, text.length))); @@ -94,14 +79,14 @@ jQuery.fn.highlightText = function(text, className) { } else if (!jQuery(node).is("button, select, textarea")) { jQuery.each(node.childNodes, function() { - highlight(this); + highlight(this) }); } } return this.each(function() { highlight(this); }); -}; +} /** * Small JavaScript module for the documentation. @@ -111,7 +96,7 @@ var Documentation = { init : function() { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); - this.initIndexTable(); + this.initModIndex(); }, /** @@ -122,7 +107,7 @@ var Documentation = { LOCALE : 'unknown', // gettext and ngettext don't access this so that the functions - // can safely bound to a different name (_ = Documentation.gettext) + // can savely bound to a different name (_ = Documentation.gettext) gettext : function(string) { var translated = Documentation.TRANSLATIONS[string]; if (typeof translated == 'undefined') @@ -182,29 +167,29 @@ var Documentation = { var body = $('div.body'); window.setTimeout(function() { $.each(terms, function() { - body.highlightText(this.toLowerCase(), 'highlighted'); + body.highlightText(this.toLowerCase(), 'highlight'); }); }, 10); - $('') - .appendTo($('#searchbox')); + $('') + .appendTo($('.sidebar .this-page-menu')); } }, /** - * init the domain index toggle buttons + * init the modindex toggle buttons */ - initIndexTable : function() { + initModIndex : function() { var togglers = $('img.toggler').click(function() { var src = $(this).attr('src'); var idnum = $(this).attr('id').substr(7); - $('tr.cg-' + idnum).toggle(); + console.log($('tr.cg-' + idnum).toggle()); if (src.substr(-9) == 'minus.png') $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); else $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); }).css('display', ''); - if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + if (DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX) { togglers.click(); } }, @@ -213,8 +198,8 @@ var Documentation = { * helper function to hide the search marks again */ hideSearchWords : function() { - $('#searchbox .highlight-link').fadeOut(300); - $('span.highlighted').removeClass('highlighted'); + $('.sidebar .this-page-menu li.highlight-link').fadeOut(300); + $('span.highlight').removeClass('highlight'); }, /** diff --git a/doc/html/_static/jquery.js b/doc/html/_static/jquery.js index 7c24308..9263574 100644 --- a/doc/html/_static/jquery.js +++ b/doc/html/_static/jquery.js @@ -1,154 +1,4376 @@ /*! - * jQuery JavaScript Library v1.4.2 + * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){ + +var + // Will speed up references to window, and allows munging its name. + window = this, + // Will speed up references to undefined, and allows munging its name. + undefined, + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + // Map over the $ in case of overwrite + _$ = window.$, + + jQuery = window.jQuery = window.$ = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context ); + }, + + // A simple way to check for HTML strings or ID strings + // (both of which we optimize for) + quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, + // Is it a simple selector + isSimple = /^.[^:#\[\.,]*$/; + +jQuery.fn = jQuery.prototype = { + init: function( selector, context ) { + // Make sure that a selection was provided + selector = selector || document; + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this[0] = selector; + this.length = 1; + this.context = selector; + return this; + } + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + var match = quickExpr.exec( selector ); + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) + selector = jQuery.clean( [ match[1] ], context ); + + // HANDLE: $("#id") + else { + var elem = document.getElementById( match[3] ); + + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem && elem.id != match[3] ) + return jQuery().find( selector ); + + // Otherwise, we inject the element directly into the jQuery object + var ret = jQuery( elem || [] ); + ret.context = document; + ret.selector = selector; + return ret; + } + + // HANDLE: $(expr, [context]) + // (which is just equivalent to: $(content).find(expr) + } else + return jQuery( context ).find( selector ); + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) + return jQuery( document ).ready( selector ); + + // Make sure that old selector state is passed along + if ( selector.selector && selector.context ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return this.setArray(jQuery.isArray( selector ) ? + selector : + jQuery.makeArray(selector)); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.3.2", + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num === undefined ? + + // Return a 'clean' array + Array.prototype.slice.call( this ) : + + // Return just the object + this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = jQuery( elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) + ret.selector = this.selector + (this.selector ? " " : "") + selector; + else if ( name ) + ret.selector = this.selector + "." + name + "(" + selector + ")"; + + // Return the newly-formed element set + return ret; + }, + + // Force the current matched set of elements to become + // the specified array of elements (destroying the stack in the process) + // You should use pushStack() in order to do this, but maintain the stack + setArray: function( elems ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + this.length = 0; + Array.prototype.push.apply( this, elems ); + + return this; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem && elem.jquery ? elem[0] : elem + , this ); + }, + + attr: function( name, value, type ) { + var options = name; + + // Look for the case where we're accessing a style value + if ( typeof name === "string" ) + if ( value === undefined ) + return this[0] && jQuery[ type || "attr" ]( this[0], name ); + + else { + options = {}; + options[ name ] = value; + } + + // Check to see if we're setting style values + return this.each(function(i){ + // Set all the styles + for ( name in options ) + jQuery.attr( + type ? + this.style : + this, + name, jQuery.prop( this, options[ name ], type, i, name ) + ); + }); + }, + + css: function( key, value ) { + // ignore negative width and height values + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) + value = undefined; + return this.attr( key, value, "curCSS" ); + }, + + text: function( text ) { + if ( typeof text !== "object" && text != null ) + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); + + var ret = ""; + + jQuery.each( text || this, function(){ + jQuery.each( this.childNodes, function(){ + if ( this.nodeType != 8 ) + ret += this.nodeType != 1 ? + this.nodeValue : + jQuery.fn.text( [ this ] ); + }); + }); + + return ret; + }, + + wrapAll: function( html ) { + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).clone(); + + if ( this[0].parentNode ) + wrap.insertBefore( this[0] ); + + wrap.map(function(){ + var elem = this; + + while ( elem.firstChild ) + elem = elem.firstChild; + + return elem; + }).append(this); + } + + return this; + }, + + wrapInner: function( html ) { + return this.each(function(){ + jQuery( this ).contents().wrapAll( html ); + }); + }, + + wrap: function( html ) { + return this.each(function(){ + jQuery( this ).wrapAll( html ); + }); + }, + + append: function() { + return this.domManip(arguments, true, function(elem){ + if (this.nodeType == 1) + this.appendChild( elem ); + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function(elem){ + if (this.nodeType == 1) + this.insertBefore( elem, this.firstChild ); + }); + }, + + before: function() { + return this.domManip(arguments, false, function(elem){ + this.parentNode.insertBefore( elem, this ); + }); + }, + + after: function() { + return this.domManip(arguments, false, function(elem){ + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + }, + + end: function() { + return this.prevObject || jQuery( [] ); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: [].push, + sort: [].sort, + splice: [].splice, + + find: function( selector ) { + if ( this.length === 1 ) { + var ret = this.pushStack( [], "find", selector ); + ret.length = 0; + jQuery.find( selector, this[0], ret ); + return ret; + } else { + return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ + return jQuery.find( selector, elem ); + })), "find", selector ); + } + }, + + clone: function( events ) { + // Do the clone + var ret = this.map(function(){ + if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { + // IE copies events bound via attachEvent when + // using cloneNode. Calling detachEvent on the + // clone will also remove the events from the orignal + // In order to get around this, we use innerHTML. + // Unfortunately, this means some modifications to + // attributes in IE that are actually only stored + // as properties will not be copied (such as the + // the name attribute on an input). + var html = this.outerHTML; + if ( !html ) { + var div = this.ownerDocument.createElement("div"); + div.appendChild( this.cloneNode(true) ); + html = div.innerHTML; + } + + return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; + } else + return this.cloneNode(true); + }); + + // Copy the events from the original to the clone + if ( events === true ) { + var orig = this.find("*").andSelf(), i = 0; + + ret.find("*").andSelf().each(function(){ + if ( this.nodeName !== orig[i].nodeName ) + return; + + var events = jQuery.data( orig[i], "events" ); + + for ( var type in events ) { + for ( var handler in events[ type ] ) { + jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); + } + } + + i++; + }); + } + + // Return the cloned set + return ret; + }, + + filter: function( selector ) { + return this.pushStack( + jQuery.isFunction( selector ) && + jQuery.grep(this, function(elem, i){ + return selector.call( elem, i ); + }) || + + jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ + return elem.nodeType === 1; + }) ), "filter", selector ); + }, + + closest: function( selector ) { + var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, + closer = 0; + + return this.map(function(){ + var cur = this; + while ( cur && cur.ownerDocument ) { + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { + jQuery.data(cur, "closest", closer); + return cur; + } + cur = cur.parentNode; + closer++; + } + }); + }, + + not: function( selector ) { + if ( typeof selector === "string" ) + // test special case where just one selector is passed in + if ( isSimple.test( selector ) ) + return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); + else + selector = jQuery.multiFilter( selector, this ); + + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; + return this.filter(function() { + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; + }); + }, + + add: function( selector ) { + return this.pushStack( jQuery.unique( jQuery.merge( + this.get(), + typeof selector === "string" ? + jQuery( selector ) : + jQuery.makeArray( selector ) + ))); + }, + + is: function( selector ) { + return !!selector && jQuery.multiFilter( selector, this ).length > 0; + }, + + hasClass: function( selector ) { + return !!selector && this.is( "." + selector ); + }, + + val: function( value ) { + if ( value === undefined ) { + var elem = this[0]; + + if ( elem ) { + if( jQuery.nodeName( elem, 'option' ) ) + return (elem.attributes.value || {}).specified ? elem.value : elem.text; + + // We need to handle select boxes special + if ( jQuery.nodeName( elem, "select" ) ) { + var index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type == "select-one"; + + // Nothing was selected + if ( index < 0 ) + return null; + + // Loop through all the selected options + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { + var option = options[ i ]; + + if ( option.selected ) { + // Get the specifc value for the option + value = jQuery(option).val(); + + // We don't need an array for one selects + if ( one ) + return value; + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + } + + // Everything else, we just grab the value + return (elem.value || "").replace(/\r/g, ""); + + } + + return undefined; + } + + if ( typeof value === "number" ) + value += ''; + + return this.each(function(){ + if ( this.nodeType != 1 ) + return; + + if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) + this.checked = (jQuery.inArray(this.value, value) >= 0 || + jQuery.inArray(this.name, value) >= 0); + + else if ( jQuery.nodeName( this, "select" ) ) { + var values = jQuery.makeArray(value); + + jQuery( "option", this ).each(function(){ + this.selected = (jQuery.inArray( this.value, values ) >= 0 || + jQuery.inArray( this.text, values ) >= 0); + }); + + if ( !values.length ) + this.selectedIndex = -1; + + } else + this.value = value; + }); + }, + + html: function( value ) { + return value === undefined ? + (this[0] ? + this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : + null) : + this.empty().append( value ); + }, + + replaceWith: function( value ) { + return this.after( value ).remove(); + }, + + eq: function( i ) { + return this.slice( i, +i + 1 ); + }, + + slice: function() { + return this.pushStack( Array.prototype.slice.apply( this, arguments ), + "slice", Array.prototype.slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function(elem, i){ + return callback.call( elem, i, elem ); + })); + }, + + andSelf: function() { + return this.add( this.prevObject ); + }, + + domManip: function( args, table, callback ) { + if ( this[0] ) { + var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), + scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), + first = fragment.firstChild; + + if ( first ) + for ( var i = 0, l = this.length; i < l; i++ ) + callback.call( root(this[i], first), this.length > 1 || i > 0 ? + fragment.cloneNode(true) : fragment ); + + if ( scripts ) + jQuery.each( scripts, evalScript ); + } + + return this; + + function root( elem, cur ) { + return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? + (elem.getElementsByTagName("tbody")[0] || + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : + elem; + } + } +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +function evalScript( i, elem ) { + if ( elem.src ) + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + + else + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + + if ( elem.parentNode ) + elem.parentNode.removeChild( elem ); +} + +function now(){ + return +new Date; +} + +jQuery.extend = jQuery.fn.extend = function() { + // copy reference to target object + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) + target = {}; + + // extend jQuery itself if only one argument is passed + if ( length == i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) + // Extend the base object + for ( var name in options ) { + var src = target[ name ], copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) + continue; + + // Recurse if we're merging object values + if ( deep && copy && typeof copy === "object" && !copy.nodeType ) + target[ name ] = jQuery.extend( deep, + // Never move original objects, clone them + src || ( copy.length != null ? [ ] : { } ) + , copy ); + + // Don't bring in undefined values + else if ( copy !== undefined ) + target[ name ] = copy; + + } + + // Return the modified object + return target; +}; + +// exclude the following css properties to add px +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, + // cache defaultView + defaultView = document.defaultView || {}, + toString = Object.prototype.toString; + +jQuery.extend({ + noConflict: function( deep ) { + window.$ = _$; + + if ( deep ) + window.jQuery = _jQuery; + + return jQuery; + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return toString.call(obj) === "[object Function]"; + }, + + isArray: function( obj ) { + return toString.call(obj) === "[object Array]"; + }, + + // check if an element is in a (or is an) XML document + isXMLDoc: function( elem ) { + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || + !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); + }, + + // Evalulates a script in a global context + globalEval: function( data ) { + if ( data && /\S/.test(data) ) { + // Inspired by code by Andrea Giammarchi + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html + var head = document.getElementsByTagName("head")[0] || document.documentElement, + script = document.createElement("script"); + + script.type = "text/javascript"; + if ( jQuery.support.scriptEval ) + script.appendChild( document.createTextNode( data ) ); + else + script.text = data; + + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709). + head.insertBefore( script, head.firstChild ); + head.removeChild( script ); + } + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, length = object.length; + + if ( args ) { + if ( length === undefined ) { + for ( name in object ) + if ( callback.apply( object[ name ], args ) === false ) + break; + } else + for ( ; i < length; ) + if ( callback.apply( object[ i++ ], args ) === false ) + break; + + // A special, fast, case for the most common use of each + } else { + if ( length === undefined ) { + for ( name in object ) + if ( callback.call( object[ name ], name, object[ name ] ) === false ) + break; + } else + for ( var value = object[0]; + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} + } + + return object; + }, + + prop: function( elem, value, type, i, name ) { + // Handle executable functions + if ( jQuery.isFunction( value ) ) + value = value.call( elem, i ); + + // Handle passing in a number to a CSS property + return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? + value + "px" : + value; + }, + + className: { + // internal only, use addClass("class") + add: function( elem, classNames ) { + jQuery.each((classNames || "").split(/\s+/), function(i, className){ + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) + elem.className += (elem.className ? " " : "") + className; + }); + }, + + // internal only, use removeClass("class") + remove: function( elem, classNames ) { + if (elem.nodeType == 1) + elem.className = classNames !== undefined ? + jQuery.grep(elem.className.split(/\s+/), function(className){ + return !jQuery.className.has( classNames, className ); + }).join(" ") : + ""; + }, + + // internal only, use hasClass("class") + has: function( elem, className ) { + return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; + } + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var old = {}; + // Remember the old values, and insert the new ones + for ( var name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + callback.call( elem ); + + // Revert the old values + for ( var name in options ) + elem.style[ name ] = old[ name ]; + }, + + css: function( elem, name, force, extra ) { + if ( name == "width" || name == "height" ) { + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; + + function getWH() { + val = name == "width" ? elem.offsetWidth : elem.offsetHeight; + + if ( extra === "border" ) + return; + + jQuery.each( which, function() { + if ( !extra ) + val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; + if ( extra === "margin" ) + val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; + else + val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; + }); + } + + if ( elem.offsetWidth !== 0 ) + getWH(); + else + jQuery.swap( elem, props, getWH ); + + return Math.max(0, Math.round(val)); + } + + return jQuery.curCSS( elem, name, force ); + }, + + curCSS: function( elem, name, force ) { + var ret, style = elem.style; + + // We need to handle opacity special in IE + if ( name == "opacity" && !jQuery.support.opacity ) { + ret = jQuery.attr( style, "opacity" ); + + return ret == "" ? + "1" : + ret; + } + + // Make sure we're using the right name for getting the float value + if ( name.match( /float/i ) ) + name = styleFloat; + + if ( !force && style && style[ name ] ) + ret = style[ name ]; + + else if ( defaultView.getComputedStyle ) { + + // Only "float" is needed here + if ( name.match( /float/i ) ) + name = "float"; + + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); + + var computedStyle = defaultView.getComputedStyle( elem, null ); + + if ( computedStyle ) + ret = computedStyle.getPropertyValue( name ); + + // We should always get a number back from opacity + if ( name == "opacity" && ret == "" ) + ret = "1"; + + } else if ( elem.currentStyle ) { + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ + return letter.toUpperCase(); + }); + + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { + // Remember the original values + var left = style.left, rsLeft = elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + elem.runtimeStyle.left = elem.currentStyle.left; + style.left = ret || 0; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + elem.runtimeStyle.left = rsLeft; + } + } + + return ret; + }, + + clean: function( elems, context, fragment ) { + context = context || document; + + // !context.createElement fails in IE with an error but returns typeof 'object' + if ( typeof context.createElement === "undefined" ) + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { + var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); + if ( match ) + return [ context.createElement( match[1] ) ]; + } + + var ret = [], scripts = [], div = context.createElement("div"); + + jQuery.each(elems, function(i, elem){ + if ( typeof elem === "number" ) + elem += ''; + + if ( !elem ) + return; + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? + all : + front + ">"; + }); + + // Trim whitespace, otherwise indexOf won't work as expected + var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); + + var wrap = + // option or optgroup + !tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && + [ 1, "", "
" ] || + + !tags.indexOf("", "" ] || + + // matched above + (!tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + // IE can't serialize and - - + @@ -49,249 +41,123 @@
-

Index

- -
- A - | C - | D - | F - | G - | H - | I - | O - | P - | R - | S - | U - | V - -
-

A

- - - -
- -
add_certificate() (httplib2.Http method) -
+

Index

-
- -
add_credentials() (httplib2.Http method) -
+ A | C | D | F | G | H | I | O | P | R | S | U | V -
+
+ + +

A

+
+
+ +
add_certificate() (httplib2.Http method)
+
add_credentials() (httplib2.Http method)
+

C

- -
- -
clear_credentials() (httplib2.Http method) -
+ -
+
-
+
clear_credentials() (httplib2.Http method)
+

D

- - -
- -
debuglevel (in module httplib2) -
- -
- -
delete() (httplib2.Cache method) -
+ -
+
-
+
debuglevel (in module httplib2)
+
delete() (httplib2.Cache method)
+

F

- - - -
- -
FailedToDecompressContent -
- - -
FileCache (class in httplib2) -
- - -
follow_all_redirects (httplib2.Http attribute) -
- - -
follow_redirects (httplib2.Http attribute) -
- -
- -
force_exception_to_status_code (httplib2.Http attribute) -
- - -
forward_authorization_headers (httplib2.Http attribute) -
- - -
fromcache (httplib2.Response attribute) -
- -
+
+
+ +
FailedToDecompressContent
+
FileCache (class in httplib2)
+
follow_all_redirects (httplib2.Http attribute)
+
follow_redirects (httplib2.Http attribute)
+
force_exception_to_status_code (httplib2.Http attribute)
+
forward_authorization_headers (httplib2.Http attribute)
+
fromcache (httplib2.Response attribute)
+

G

- -
- -
get() (httplib2.Cache method) -
+ -
+
-
+
get() (httplib2.Cache method)
+

H

- - -
- -
Http (class in httplib2) -
- - -
httplib2 (module) -
- -
- -
HttpLib2Error -
+ -
+
-
+
Http (class in httplib2)
+
httplib2 (module)
+
HttpLib2Error
+

I

- -
- -
ignore_etag (httplib2.Http attribute) -
+ -
+
-
+
ignore_etag (httplib2.Http attribute)
+

O

- -
- -
optimistic_concurrency_methods (httplib2.Http attribute) -
+ -
+
-
+
optimistic_concurrency_methods (httplib2.Http attribute)
+

P

- -
- -
previous (httplib2.Response attribute) -
+ - -
+
-
- -
ProxyInfo (class in httplib2) -
- -
+
previous (httplib2.Response attribute)
+
ProxyInfo (class in httplib2)
+

R

- - - -
- -
reason (httplib2.Response attribute) -
- - -
RedirectLimit -
- - -
RedirectMissingLocation -
- - -
RelativeURIError -
- -
- -
request() (httplib2.Http method) -
- - -
Response (class in httplib2) -
- - -
RETRIES (in module httplib2) -
- -
+
+
+ +
reason (httplib2.Response attribute)
+
RedirectLimit
+
RedirectMissingLocation
+
RelativeURIError
+
request() (httplib2.Http method)
+
Response (class in httplib2)
+
RETRIES (in module httplib2)
+

S

- -
- -
ServerNotFoundError -
+ - -
+
- -
set() (httplib2.Cache method) -
- -
- -
status (httplib2.Response attribute) -
- -
+
ServerNotFoundError
+
set() (httplib2.Cache method)
+
status (httplib2.Response attribute)
+

U

- -
- -
UnimplementedDigestAuthOptionError -
+ - -
+
-
- -
UnimplementedHmacDigestAuthOptionError -
- -
+
UnimplementedDigestAuthOptionError
+
UnimplementedHmacDigestAuthOptionError
+

V

- -
- -
version (httplib2.Response attribute) -
+ -
+
-
+
version (httplib2.Response attribute)
+
@@ -303,19 +169,19 @@ - - + +
@@ -327,15 +193,15 @@ index
  • - modules |
  • -
  • httplib2 0.4 documentation »
  • +
  • httplib2 v0.4 documentation »
  • \ No newline at end of file diff --git a/doc/html/index.html b/doc/html/index.html index 606200b..330adc5 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,31 +1,25 @@ - - - - The httplib2 Library — httplib2 0.4 documentation - + The httplib2 Library — httplib2 v0.4 documentation - - - + @@ -36,12 +30,12 @@ index
  • - modules |
  • + modules |
  • next |
  • -
  • httplib2 0.4 documentation »
  • +
  • httplib2 v0.4 documentation »
  • @@ -56,35 +50,33 @@ -Author:Joe Gregorio +Author:Joe Gregorio -Date:Mar 8, 2007 +Date:Mar 8, 2007

    Abstract

    -

    The httplib2 module is a comprehensive HTTP client library that handles +

    The httplib2 module is a comprehensive HTTP client library that handles caching, keep-alive, compression, redirects and many kinds of authentication.

    Contents:

    - @@ -95,35 +87,35 @@ caching, keep-alive, compression, redirects and many kinds of authentication.

    -

    Table Of Contents

    -
    @@ -135,18 +127,18 @@ caching, keep-alive, compression, redirects and many kinds of authentication.

    index
  • - modules |
  • next |
  • -
  • httplib2 0.4 documentation »
  • +
  • httplib2 v0.4 documentation »
  • \ No newline at end of file diff --git a/doc/html/libhttplib2.html b/doc/html/libhttplib2.html index 12301a4..ec9048b 100644 --- a/doc/html/libhttplib2.html +++ b/doc/html/libhttplib2.html @@ -1,31 +1,25 @@ - - - - httplib2 A comprehensive HTTP client library. — httplib2 0.4 documentation - + httplib2 A comprehensive HTTP client library. — httplib2 v0.4 documentation - - - + @@ -36,12 +30,12 @@ index
  • - modules |
  • + modules |
  • previous |
  • -
  • httplib2 0.4 documentation »
  • +
  • httplib2 v0.4 documentation »
  • @@ -51,22 +45,20 @@
    -

    httplib2 A comprehensive HTTP client library.

    -

    The httplib2 module is a comprehensive HTTP client library with the +

    httplib2 A comprehensive HTTP client library.

    +

    The httplib2 module is a comprehensive HTTP client library with the following features:

    HTTP and HTTPS
    -

    HTTPS support is only available if the socket module was compiled with SSL -support.

    -
    +
    HTTPS support is only available if the socket module was compiled with SSL +support.
    Keep-Alive
    -

    Supports HTTP 1.1 Keep-Alive, keeping the socket open and performing multiple -requests over the same connection if possible.

    -
    +
    Supports HTTP 1.1 Keep-Alive, keeping the socket open and performing multiple +requests over the same connection if possible.
    @@ -74,128 +66,112 @@ requests over the same connection if possible.

    The following three types of HTTP Authentication are supported. These can be used over both HTTP and HTTPS.

    -
      +
      • Digest
      • Basic
      • WSSE
      -
    +
    Caching
    -

    The module can optionally operate with a private cache that understands the -Cache-Control: header and uses both the ETag and Last-Modified cache validators.

    -
    +
    The module can optionally operate with a private cache that understands the +Cache-Control: header and uses both the ETag and Last-Modified cache validators.
    All Methods
    -

    The module can handle any HTTP request method, not just GET and POST.

    -
    +
    The module can handle any HTTP request method, not just GET and POST.
    Redirects
    -

    Automatically follows 3XX redirects on GETs.

    -
    +
    Automatically follows 3XX redirects on GETs.
    Compression
    -

    Handles both deflate and gzip types of compression.

    -
    +
    Handles both deflate and gzip types of compression.
    Lost update support
    -

    Automatically adds back ETags into PUT requests to resources we have already +

    Automatically adds back ETags into PUT requests to resources we have already cached. This implements Section 3.2 of Detecting the Lost Update Problem Using -Unreserved Checkout

    -
    +Unreserved Checkout -

    The httplib2 module defines the following variables:

    +

    The httplib2 module defines the following variables:

    httplib2.debuglevel
    -

    The amount of debugging information to print. The default is 0.

    -
    +
    The amount of debugging information to print. The default is 0.
    httplib2.RETRIES
    -

    A request will be tried ‘RETRIES’ times if it fails at the socket/connection level. -The default is 2.

    -
    +
    A request will be tried ‘RETRIES’ times if it fails at the socket/connection level. +The default is 2.
    -

    The httplib2 module may raise the following Exceptions. Note that there +

    The httplib2 module may raise the following Exceptions. Note that there is an option that turns exceptions into normal responses with an HTTP status code indicating an error occured. See -Http.force_exception_to_status_code

    +Http.force_exception_to_status_code

    exception httplib2.HttpLib2Error
    -

    The Base Exception for all exceptions raised by httplib2.

    -
    +
    The Base Exception for all exceptions raised by httplib2.
    exception httplib2.RedirectMissingLocation
    -

    A 3xx redirect response code was provided but no Location: header was provided -to point to the new location.

    -
    +
    A 3xx redirect response code was provided but no Location: header was provided +to point to the new location.
    exception httplib2.RedirectLimit
    -

    The maximum number of redirections was reached without coming to a final URI.

    -
    +
    The maximum number of redirections was reached without coming to a final URI.
    exception httplib2.ServerNotFoundError
    -

    Unable to resolve the host name given.

    -
    +
    Unable to resolve the host name given.
    exception httplib2.RelativeURIError
    -

    A relative, as opposed to an absolute URI, was passed into request().

    -
    +
    A relative, as opposed to an absolute URI, was passed into request().
    exception httplib2.FailedToDecompressContent
    -

    The headers claimed that the content of the response was compressed but the -decompression algorithm applied to the content failed.

    -
    +
    The headers claimed that the content of the response was compressed but the +decompression algorithm applied to the content failed.
    exception httplib2.UnimplementedDigestAuthOptionError
    -

    The server requested a type of Digest authentication that we are unfamiliar -with.

    -
    +
    The server requested a type of Digest authentication that we are unfamiliar +with.
    exception httplib2.UnimplementedHmacDigestAuthOptionError
    -

    The server requested a type of HMACDigest authentication that we are unfamiliar -with.

    -
    +
    The server requested a type of HMACDigest authentication that we are unfamiliar +with.
    -class httplib2.Http([cache=None][, timeout=None][, proxy_info=None][, ca_certs=None][, disable_ssl_certificate_validation=False])
    -

    The class that represents a client HTTP interface. The cache parameter is +class httplib2.Http([cache=None][, timeout=None][, proxy_info==ProxyInfo.from_environment][, ca_certs=None][, disable_ssl_certificate_validation=False]) +

    The class that represents a client HTTP interface. The cache parameter is either the name of a directory to be used as a flat file cache, or it must an object that implements the required caching interface. The timeout parameter is the socket level timeout. The ca_certs parameter is the filename of the CA certificates to use. If none is given a default set is used. The disable_ssl_certificate_validation boolean flag determines if ssl certificate validation -is done. The proxy_info parameter is an object of type :class:ProxyInfo.

    -
    +is done. The proxy_info parameter is an object of type :class:ProxyInfo.
    @@ -209,21 +185,19 @@ constants. For example:

    class httplib2.Response(info)
    -

    Response is a subclass of dict and instances of this class are +

    Response is a subclass of dict and instances of this class are returned from calls to Http.request. The info parameter is either an -rfc822.Message or an httplib.HTTPResponse object.

    -
    +rfc822.Message or an httplib.HTTPResponse object.
    class httplib2.FileCache(dir_name[, safe=safename])
    -

    FileCache implements a Cache as a directory of files. The dir_name parameter +

    FileCache implements a Cache as a directory of files. The dir_name parameter is the name of the directory to use. If the directory does not exist then FileCache attempts to create the directory. The optional safe parameter is a funtion which generates the cache filename for each URI. A FileCache object is constructed and used for caching when you pass a directory name into the -constructor of Http.

    -
    +constructor of Http.

    Http objects have the following methods:

    @@ -245,97 +219,89 @@ object.

    The connection_type is the type of connection object to use. The supplied class should implement the interface of httplib.HTTPConnection.

    The return value is a tuple of (response, content), the first being and instance -of the Response class, the second being a string that contains the +of the Response class, the second being a string that contains the response entity body.

    Http.add_credentials(name, password[, domain=None])
    -

    Adds a name and password that will be used when a request requires +

    Adds a name and password that will be used when a request requires authentication. Supplying the optional domain name will restrict these credentials to only be sent to the specified domain. If domain is not specified then the given credentials will be used to try to satisfy every HTTP -401 challenge.

    -
    +401 challenge.
    Http.add_certificate(key, cert, domain)
    -

    Add a key and cert that will be used for an SSL connection to the specified +

    Add a key and cert that will be used for an SSL connection to the specified domain. keyfile is the name of a PEM formatted file that contains your -private key. certfile is a PEM formatted certificate chain file.

    -
    +private key. certfile is a PEM formatted certificate chain file.
    Http.clear_credentials()
    -

    Remove all the names and passwords used for authentication.

    -
    +
    Remove all the names and passwords used for authentication.
    Http.follow_redirects
    -

    If True, which is the default, safe redirects are followed, where safe means +

    If True, which is the default, safe redirects are followed, where safe means that the client is only doing a GET or HEAD on the URI to which it is -being redirected. If False then no redirects are followed. Note that a False +being redirected. If False then no redirects are followed. Note that a False ‘follow_redirects’ takes precedence over a True ‘follow_all_redirects’. Another way of saying that is for ‘follow_all_redirects’ to have any affect, -‘follow_redirects’ must be True.

    -
    +‘follow_redirects’ must be True.
    Http.follow_all_redirects
    -

    If False, which is the default, only safe redirects are followed, where safe +

    If False, which is the default, only safe redirects are followed, where safe means that the client is only doing a GET or HEAD on the URI to which it -is being redirected. If True then all redirects are followed. Note that a +is being redirected. If True then all redirects are followed. Note that a False ‘follow_redirects’ takes precedence over a True ‘follow_all_redirects’. Another way of saying that is for ‘follow_all_redirects’ to have any affect, -‘follow_redirects’ must be True.

    -
    +‘follow_redirects’ must be True.
    Http.forward_authorization_headers
    -

    If False, which is the default, then Authorization: headers are -stripped from redirects. If True then Authorization: headers are left +

    If False, which is the default, then Authorization: headers are +stripped from redirects. If True then Authorization: headers are left in place when following redirects. This parameter only applies if following redirects is turned on. Note that turning this on could cause your credentials -to leak, so carefully consider the consequences.

    -
    +to leak, so carefully consider the consequences.
    Http.force_exception_to_status_code
    -

    If True then no httplib2 exceptions will be -thrown. Instead, those error conditions will be turned into Response +

    If True then no httplib2 exceptions will be +thrown. Instead, those error conditions will be turned into Response objects that will be returned normally.

    -

    If False, which is the default, then exceptions will be thrown.

    +

    If False, which is the default, then exceptions will be thrown.

    Http.optimistic_concurrency_methods
    -

    By default a list that only contains “PUT”, this attribute +

    By default a list that only contains “PUT”, this attribute controls which methods will get ‘if-match’ headers attached to them from cached responses with etags. You can append new items to this list to add new methods that should -get this support, such as “PATCH”.

    -
    +get this support, such as “PATCH”.
    Http.ignore_etag
    -

    Defaults to False. If True, then any etags present in the cached +

    Defaults to False. If True, then any etags present in the cached response are ignored when processing the current request, i.e. httplib2 does not use ‘if-match’ for PUT or ‘if-none-match’ when GET or HEAD requests are made. This is mainly to deal with broken servers which supply an etag, but -change it capriciously.

    -
    +change it capriciously.

    If you wish to supply your own caching implementation then you will need to pass -in an object that supports the following methods. Note that the memcache +in an object that supports the following methods. Note that the memcache module supports this interface natively.

    @@ -343,22 +309,19 @@ module supports this interface natively.

    Cache.get(key)
    -

    Takes a string key and returns the value as a string.

    -
    +
    Takes a string key and returns the value as a string.
    Cache.set(key, value)
    -

    Takes a string key and value and stores it in the cache.

    -
    +
    Takes a string key and value and stores it in the cache.
    Cache.delete(key)
    -

    Deletes the cached value stored at key. The value of key is a string.

    -
    +
    Deletes the cached value stored at key. The value of key is a string.
    -

    Response objects are derived from dict and map header names (lower case +

    Response objects are derived from dict and map header names (lower case with the trailing colon removed) to header values. In addition to the dict methods a Response object also has:

    @@ -367,45 +330,40 @@ methods a Response object also has:

    Response.fromcache
    -

    If true the the response was returned from the cache.

    -
    +
    If true the the response was returned from the cache.
    Response.version
    -

    The version of HTTP that the server supports. A value of 11 means ‘1.1’.

    -
    +
    The version of HTTP that the server supports. A value of 11 means ‘1.1’.
    Response.status
    -

    The numerical HTTP status code returned in the response.

    -
    +
    The numerical HTTP status code returned in the response.
    Response.reason
    -

    The human readable component of the HTTP response status code.

    -
    +
    The human readable component of the HTTP response status code.
    Response.previous
    -

    If redirects are followed then the Response object returned is just for +

    If redirects are followed then the Response object returned is just for the very last HTTP request and previous points to the previous -Response object. In this manner they form a chain going back through -the responses to the very first response. Will be None if there are no -previous respones.

    -
    +Response object. In this manner they form a chain going back through +the responses to the very first response. Will be None if there are no +previous respones.

    The Response object also populates the header content-location, that contains the URI that was ultimately requested. This is useful if redirects were encountered, you can determine the ultimate URI that the request was sent to. All Response objects contain this key value, including previous responses so you can determine the entire chain of redirects. If -Http.force_exception_to_status_code is True and the number of +Http.force_exception_to_status_code is True and the number of redirects has exceeded the number of allowed number of redirects then the -Response object will report the error in the status code, but the +Response object will report the error in the status code, but the complete chain of previous responses will still be in tact.

    To do a simple GET request just supply the absolute URI of the resource:

    @@ -472,38 +430,38 @@ request.

    -

    Table Of Contents

    -
    @@ -515,18 +473,18 @@ request.

    index
  • - modules |
  • previous |
  • -
  • httplib2 0.4 documentation »
  • +
  • httplib2 v0.4 documentation »
  • \ No newline at end of file diff --git a/doc/html/modindex.html b/doc/html/modindex.html index 868353b..881226a 100644 --- a/doc/html/modindex.html +++ b/doc/html/modindex.html @@ -97,7 +97,7 @@ diff --git a/doc/html/objects.inv b/doc/html/objects.inv index 5b3e2fd..4f1fd85 100644 Binary files a/doc/html/objects.inv and b/doc/html/objects.inv differ diff --git a/doc/html/search.html b/doc/html/search.html index 92973d7..a169c98 100644 --- a/doc/html/search.html +++ b/doc/html/search.html @@ -1,37 +1,26 @@ - - - - Search — httplib2 0.4 documentation - + Search — httplib2 v0.4 documentation - - - - - - + @@ -92,15 +81,18 @@ index
  • - modules |
  • -
  • httplib2 0.4 documentation »
  • +
  • httplib2 v0.4 documentation »
  • + + + \ No newline at end of file diff --git a/doc/html/searchindex.js b/doc/html/searchindex.js index e71997e..faf351f 100644 --- a/doc/html/searchindex.js +++ b/doc/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"":{httplib2:[1,0,1,""]},"httplib2.Response":{status:[1,3,1,""],reason:[1,3,1,""],version:[1,3,1,""],previous:[1,3,1,""],fromcache:[1,3,1,""]},"httplib2.Cache":{get:[1,2,1,""],set:[1,2,1,""],"delete":[1,2,1,""]},"httplib2.Http":{forward_authorization_headers:[1,3,1,""],follow_redirects:[1,3,1,""],request:[1,2,1,""],force_exception_to_status_code:[1,3,1,""],clear_credentials:[1,2,1,""],optimistic_concurrency_methods:[1,3,1,""],follow_all_redirects:[1,3,1,""],add_certificate:[1,2,1,""],ignore_etag:[1,3,1,""],add_credentials:[1,2,1,""]},httplib2:{HttpLib2Error:[1,4,1,""],RETRIES:[1,5,1,""],Http:[1,1,1,""],FileCache:[1,1,1,""],UnimplementedHmacDigestAuthOptionError:[1,4,1,""],FailedToDecompressContent:[1,4,1,""],Response:[1,1,1,""],ServerNotFoundError:[1,4,1,""],RedirectMissingLocation:[1,4,1,""],debuglevel:[1,5,1,""],RedirectLimit:[1,4,1,""],RelativeURIError:[1,4,1,""],ProxyInfo:[1,1,1,""],UnimplementedDigestAuthOptionError:[1,4,1,""]}},terms:{all:1,code:1,chain:1,proxy_type_xxx:1,follow:1,privat:1,readabl:1,those:1,sent:1,liter:1,everi:1,string:1,fals:1,unfamiliar:1,proxy_typ:1,veri:1,affect:1,tri:1,force_exception_to_status_cod:1,level:1,list:1,"try":1,item:1,consequ:1,second:1,pass:1,"13t18":1,append:1,index:0,section:1,current:1,delet:1,version:1,"new":1,method:1,funtion:1,redirect:[0,1],deriv:1,gener:1,here:1,bodi:1,proxy_us:1,address:1,redirectmissingloc:1,ignore_etag:1,modifi:1,valu:1,search:0,respon:1,proxy_rdn:1,memcach:1,amount:1,implement:1,extra:1,appli:1,modul:[0,1],keyfil:1,filenam:1,"boolean":1,from:1,call:1,type:1,more:1,flat:1,trail:1,flag:1,cach:[0,1],must:1,none:1,hmacdigest:1,optimistic_concurrency_method:1,unimplementedhmacdigestauthoptionerror:1,can:1,aliv:[0,1],control:1,claim:1,process:1,challeng:1,indic:[0,1],aaaa:1,occur:1,multipl:1,anoth:1,instead:1,simpl:1,updat:1,follow_redirect:1,mar:0,resourc:1,proxy_info:1,tact:1,befor:1,date:0,httpconnect:1,data:1,unreserv:1,attempt:1,ssl:1,credenti:1,robot:1,caus:1,inform:1,preced:1,allow:1,shadi:1,over:1,"3xx":1,through:1,still:1,mainli:1,digest:1,paramet:1,uuid:1,complex:1,comprehens:[0,1],them:1,failedtodecompresscont:1,"return":1,thei:1,handl:[0,1],safe:1,httplib2:[0,1],gregorio:0,"80da344efa6a":1,httplib:1,name:1,authent:[0,1],timeout:1,each:1,debug:1,mean:1,compil:1,domain:1,map:1,connect:1,our:1,variabl:1,proxy_pass:1,urlencod:1,publish:1,content:[0,1],etag:1,rel:1,debuglevel:1,print:1,proxi:1,fred:1,reason:1,base:1,dictionari:1,put:1,org:1,thrown:1,could:1,keep:[0,1],turn:1,place:1,unabl:1,caprici:1,first:1,oper:1,certfil:1,number:1,restrict:1,mai:1,alreadi:1,done:1,messag:1,oppos:1,open:1,given:1,disable_ssl_certificate_valid:1,construct:1,attach:1,john:1,"final":1,store:1,xmln:1,option:1,specifi:1,cfb8:1,httplib2error:1,kind:0,provid:1,remov:1,proxy_type_http:1,were:1,pre:1,sai:1,ani:1,manner:1,have:1,tabl:0,mypasswd:1,note:1,also:1,client:[0,1],take:1,which:1,singl:1,begin:1,ca_cert:1,normal:1,object:[0,1],compress:[0,1],gzip:1,"class":1,urn:1,request:1,uri:1,doe:1,determin:1,carefulli:1,text:1,unimplementeddigestauthoptionerror:1,xml:1,absolut:1,onli:1,locat:1,should:1,dict:1,bitwork:1,get:1,filecach:1,nativ:1,report:1,requir:1,patch:1,contain:1,mynam:1,where:1,certif:1,set:1,see:1,respons:[0,1],fail:1,statu:1,detect:1,urllib:1,"import":1,"02z":1,attribut:1,kei:1,numer:1,proxy_port:1,entir:1,joe:0,come:1,addit:1,both:1,last:1,etc:1,instanc:1,mani:0,com:1,point:1,header:1,colon:1,suppli:1,ultim:1,three:1,compon:1,basic:1,popul:1,wish:1,assert:1,understand:1,present:1,"case":1,plain:1,defin:1,error:1,"4ebb":1,dir_nam:1,applic:1,need:1,follow_all_redirect:1,author:[0,1],perform:1,satisfi:1,cert:1,same:1,add_certif:1,html:1,complet:1,http:[0,1],rfc822:1,decompress:1,rais:1,chang:1,lower:1,entri:1,without:1,exampl:[0,1],add_credenti:1,thi:1,entiti:1,left:1,protocol:1,just:1,resp:1,human:1,password:1,proxy_host:1,except:1,proxyinfo:1,add:1,match:1,connection_typ:1,format:1,safenam:1,httprespons:1,you:1,amok:1,redirectlimit:1,lost:1,servernotfounderror:1,docutil:1,resolv:1,server:1,collect:1,either:1,page:0,encount:1,exceed:1,deal:1,some:1,back:1,librari:[0,1],clear_credenti:1,leak:1,subclass:1,pem:1,retri:1,condit:1,localhost:1,previou:1,run:1,power:1,reach:1,broken:1,host:1,post:1,deflat:1,socket:1,default_max_redirect:1,fromcach:1,constructor:1,processor:1,own:1,www:1,automat:1,strip:1,your:1,span:1,wai:1,support:1,sock:1,avail:1,interfac:1,includ:1,head:1,form:1,tupl:1,atom:1,"true":1,info:1,made:1,possibl:1,"default":1,checkout:1,maximum:1,forward_authorization_head:1,problem:1,"1225c695":1,featur:1,constant:1,creat:1,"abstract":0,repres:1,chap:1,exist:1,file:1,relativeurierror:1,titl:1,when:1,valid:1,presum:1,consid:1,lane:1,algorithm:1,directori:1,wsse:1,ignor:1,time:1},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:exception","5":"py:data"},titles:["The httplib2 Library","httplib2 A comprehensive HTTP client library."],objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","exception","Python exception"],"5":["py","data","Python data"]},filenames:["index","libhttplib2"]}) \ No newline at end of file +Search.setIndex({desctypes:{"0":"class","1":"method","2":"attribute","3":"exception","4":"data"},terms:{all:1,code:1,chain:1,proxy_type_xxx:1,follow:1,privat:1,readabl:1,those:1,sent:1,liter:1,everi:1,string:1,fals:1,unfamiliar:1,proxy_typ:1,veri:1,affect:1,tri:1,force_exception_to_status_cod:1,level:1,list:1,"try":1,item:1,consequ:1,second:1,pass:1,"13t18":1,append:1,index:0,section:1,current:1,delet:1,version:1,"new":1,method:1,funtion:1,redirect:[0,1],deriv:1,gener:1,here:1,bodi:1,proxy_us:1,address:1,redirectmissingloc:1,ignore_etag:1,modifi:1,valu:1,search:0,respon:1,proxy_rdn:1,memcach:1,amount:1,implement:1,extra:1,appli:1,modul:[0,1],keyfil:1,filenam:1,"boolean":1,from:1,call:1,type:1,more:1,flat:1,trail:1,flag:1,cach:[0,1],must:1,none:1,hmacdigest:1,optimistic_concurrency_method:1,unimplementedhmacdigestauthoptionerror:1,can:1,aliv:[0,1],control:1,claim:1,process:1,challeng:1,indic:[0,1],aaaa:1,occur:1,multipl:1,anoth:1,instead:1,simpl:1,updat:1,follow_redirect:1,mar:0,resourc:1,proxy_info:1,tact:1,befor:1,date:0,httpconnect:1,data:1,unreserv:1,attempt:1,ssl:1,credenti:1,robot:1,caus:1,inform:1,preced:1,allow:1,shadi:1,over:1,"3xx":1,through:1,still:1,mainli:1,digest:1,paramet:1,uuid:1,complex:1,comprehens:[0,1],them:1,failedtodecompresscont:1,"return":1,thei:1,handl:[0,1],safe:1,httplib2:[0,1],gregorio:0,"80da344efa6a":1,httplib:1,name:1,authent:[0,1],timeout:1,each:1,debug:1,mean:1,compil:1,domain:1,map:1,connect:1,our:1,variabl:1,proxy_pass:1,urlencod:1,publish:1,content:[0,1],etag:1,rel:1,debuglevel:1,print:1,proxi:1,fred:1,reason:1,base:1,dictionari:1,put:1,org:1,thrown:1,could:1,keep:[0,1],turn:1,place:1,unabl:1,caprici:1,first:1,oper:1,certfil:1,number:1,restrict:1,mai:1,alreadi:1,done:1,messag:1,oppos:1,open:1,given:1,disable_ssl_certificate_valid:1,construct:1,attach:1,john:1,"final":1,store:1,xmln:1,option:1,specifi:1,cfb8:1,httplib2error:1,kind:0,provid:1,remov:1,proxy_type_http:1,were:1,pre:1,sai:1,ani:1,manner:1,have:1,tabl:0,mypasswd:1,note:1,also:1,client:[0,1],take:1,which:1,singl:1,begin:1,ca_cert:1,normal:1,object:[0,1],compress:[0,1],gzip:1,"class":1,urn:1,request:1,uri:1,doe:1,determin:1,carefulli:1,text:1,unimplementeddigestauthoptionerror:1,xml:1,absolut:1,onli:1,locat:1,should:1,dict:1,bitwork:1,get:1,filecach:1,nativ:1,report:1,requir:1,patch:1,contain:1,mynam:1,where:1,certif:1,set:1,see:1,respons:[0,1],fail:1,statu:1,detect:1,urllib:1,"import":1,"02z":1,attribut:1,kei:1,numer:1,proxy_port:1,entir:1,joe:0,come:1,addit:1,both:1,last:1,etc:1,instanc:1,mani:0,com:1,point:1,header:1,colon:1,suppli:1,ultim:1,three:1,compon:1,basic:1,popul:1,wish:1,assert:1,understand:1,present:1,"case":1,plain:1,defin:1,error:1,"4ebb":1,dir_nam:1,applic:1,need:1,follow_all_redirect:1,author:[0,1],perform:1,satisfi:1,cert:1,same:1,add_certif:1,html:1,complet:1,http:[0,1],rfc822:1,decompress:1,rais:1,chang:1,lower:1,entri:1,without:1,exampl:[0,1],add_credenti:1,thi:1,entiti:1,left:1,protocol:1,just:1,resp:1,human:1,password:1,proxy_host:1,except:1,proxyinfo:1,add:1,from_environ:1,match:1,connection_typ:1,format:1,safenam:1,httprespons:1,you:1,amok:1,redirectlimit:1,lost:1,servernotfounderror:1,docutil:1,resolv:1,server:1,collect:1,either:1,page:0,encount:1,exceed:1,deal:1,some:1,back:1,librari:[0,1],clear_credenti:1,leak:1,subclass:1,pem:1,retri:1,condit:1,localhost:1,previou:1,run:1,power:1,reach:1,broken:1,host:1,post:1,deflat:1,socket:1,default_max_redirect:1,fromcach:1,constructor:1,processor:1,own:1,www:1,automat:1,strip:1,your:1,span:1,wai:1,support:1,sock:1,avail:1,interfac:1,includ:1,head:1,form:1,tupl:1,atom:1,"true":1,info:1,made:1,possibl:1,"default":1,checkout:1,maximum:1,forward_authorization_head:1,problem:1,"1225c695":1,featur:1,constant:1,creat:1,"abstract":0,repres:1,chap:1,exist:1,file:1,relativeurierror:1,titl:1,when:1,valid:1,presum:1,consid:1,lane:1,algorithm:1,directori:1,wsse:1,ignor:1,time:1},titles:["The httplib2 Library","httplib2 A comprehensive HTTP client library."],modules:{httplib2:1},descrefs:{"httplib2.Response":{status:[1,2],reason:[1,2],version:[1,2],previous:[1,2],fromcache:[1,2]},"httplib2.Cache":{get:[1,1],set:[1,1],"delete":[1,1]},"httplib2.Http":{forward_authorization_headers:[1,2],follow_redirects:[1,2],request:[1,1],force_exception_to_status_code:[1,2],clear_credentials:[1,1],optimistic_concurrency_methods:[1,2],follow_all_redirects:[1,2],add_certificate:[1,1],ignore_etag:[1,2],add_credentials:[1,1]},httplib2:{HttpLib2Error:[1,3],RETRIES:[1,4],Http:[1,0],FileCache:[1,0],UnimplementedHmacDigestAuthOptionError:[1,3],FailedToDecompressContent:[1,3],Response:[1,0],ServerNotFoundError:[1,3],RedirectMissingLocation:[1,3],debuglevel:[1,4],RedirectLimit:[1,3],RelativeURIError:[1,3],ProxyInfo:[1,0],UnimplementedDigestAuthOptionError:[1,3]}},filenames:["index","libhttplib2"]}) \ No newline at end of file diff --git a/doc/libhttplib2.rst b/doc/libhttplib2.rst index fc72bbf..d8e33d0 100644 --- a/doc/libhttplib2.rst +++ b/doc/libhttplib2.rst @@ -193,7 +193,7 @@ code indicating an error occured. See .. % type name like methoddesc. -.. class:: Http([cache=None], [timeout=None], [proxy_info=None], [ca_certs=None], [disable_ssl_certificate_validation=False]) +.. class:: Http([cache=None], [timeout=None], [proxy_info==ProxyInfo.from_environment], [ca_certs=None], [disable_ssl_certificate_validation=False]) The class that represents a client HTTP interface. The *cache* parameter is either the name of a directory to be used as a flat file cache, or it must an diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py index 43a5564..f7af76f 100644 --- a/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py @@ -22,7 +22,7 @@ __contributors__ = ["Thomas Broyer (t.broyer@ltgt.net)", "Sam Ruby", "Louis Nyffenegger"] __license__ = "MIT" -__version__ = "0.7.4" +__version__ = "0.7.5" import re import sys @@ -1084,7 +1084,7 @@ try: """ def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=None, proxy_info=None, ca_certs=None, - disable_certificate_validation=False): + disable_ssl_certificate_validation=False): self.host = host self.port = port self.timeout = timeout @@ -1092,7 +1092,7 @@ try: raise NotSupportedOnThisPlatform() self.response = None self.scheme = 'http' - self.validate_certificate = not disable_certificate_validation + self.validate_certificate = not disable_ssl_certificate_validation self.sock = True def request(self, method, url, body, headers): @@ -1137,9 +1137,10 @@ try: class AppEngineHttpsConnection(AppEngineHttpConnection): """Same as AppEngineHttpConnection, but for HTTPS URIs.""" def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=None, timeout=None, proxy_info=None): + strict=None, timeout=None, proxy_info=None, cacerts=None, + disable_ssl_certificate_validation=False): AppEngineHttpConnection.__init__(self, host, port, key_file, cert_file, - strict, timeout, proxy_info) + strict, timeout, proxy_info, cacerts, disable_ssl_certificate_validation) self.scheme = 'https' # Update the connection classes to use the Googel App Engine specific ones. @@ -1309,7 +1310,7 @@ and more. else: content = "" if method == "HEAD": - response.close() + conn.close() else: content = response.read() response = Response(response) @@ -1445,7 +1446,7 @@ a string that contains the response entity body. if not connection_type: connection_type = SCHEME_TO_CONNECTION[scheme] certs = list(self.certificates.iter(authority)) - if issubclass(connection_type, HTTPSConnectionWithTimeout): + if scheme == 'https': if certs: conn = self.connections[conn_key] = connection_type( authority, key_file=certs[0][0], @@ -1487,7 +1488,7 @@ a string that contains the response entity body. feedparser.feed(info) info = feedparser.close() feedparser._parse = None - except IndexError: + except (IndexError, ValueError): self.cache.delete(cachekey) cachekey = None cached_value = None diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py index 5608baa..0b2318b 100644 --- a/python3/httplib2/__init__.py +++ b/python3/httplib2/__init__.py @@ -24,7 +24,7 @@ __contributors__ = ["Thomas Broyer (t.broyer@ltgt.net)", "Louis Nyffenegger", "Mark Pilgrim"] __license__ = "MIT" -__version__ = "0.7.4" +__version__ = "0.7.5" import re import sys @@ -780,6 +780,10 @@ class HTTPSConnectionWithTimeout(http.client.HTTPSConnection): check_hostname=True) +SCHEME_TO_CONNECTION = { + 'http': HTTPConnectionWithTimeout, + 'https': HTTPSConnectionWithTimeout + } class Http(object): """An HTTP client that handles: @@ -934,7 +938,7 @@ and more. else: content = b"" if method == "HEAD": - response.close() + conn.close() else: content = response.read() response = Response(response) @@ -1067,7 +1071,7 @@ a string that contains the response entity body. conn = self.connections[conn_key] else: if not connection_type: - connection_type = (scheme == 'https') and HTTPSConnectionWithTimeout or HTTPConnectionWithTimeout + connection_type = SCHEME_TO_CONNECTION[scheme] certs = list(self.certificates.iter(authority)) if issubclass(connection_type, HTTPSConnectionWithTimeout): if certs: @@ -1107,7 +1111,7 @@ a string that contains the response entity body. if v.startswith('=?') and v.endswith('?='): info.replace_header(k, str(*email.header.decode_header(v)[0])) - except IndexError: + except (IndexError, ValueError): self.cache.delete(cachekey) cachekey = None cached_value = None diff --git a/setup.py b/setup.py index 41c186d..925c929 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: import sys pkgdir = {'': 'python%s' % sys.version_info[0]} -VERSION = '0.7.4' +VERSION = '0.7.5' setup(name='httplib2', version=VERSION, -- cgit v1.2.1