| OLD | NEW |
| 1 from __future__ import generators | 1 from __future__ import generators |
| 2 """ | 2 """ |
| 3 httplib2 | 3 httplib2 |
| 4 | 4 |
| 5 A caching http interface that supports ETags and gzip | 5 A caching http interface that supports ETags and gzip |
| 6 to conserve bandwidth. | 6 to conserve bandwidth. |
| 7 | 7 |
| 8 Requires Python 2.3 or later | 8 Requires Python 2.3 or later |
| 9 | 9 |
| 10 Changelog: | 10 Changelog: |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 DEFAULT_MAX_REDIRECTS = 5 | 185 DEFAULT_MAX_REDIRECTS = 5 |
| 186 | 186 |
| 187 try: | 187 try: |
| 188 # Users can optionally provide a module that tells us where the CA_CERTS | 188 # Users can optionally provide a module that tells us where the CA_CERTS |
| 189 # are located. | 189 # are located. |
| 190 import ca_certs_locater | 190 import ca_certs_locater |
| 191 CA_CERTS = ca_certs_locater.get() | 191 CA_CERTS = ca_certs_locater.get() |
| 192 except ImportError: | 192 except ImportError: |
| 193 # Default CA certificates file bundled with httplib2. | 193 # Default CA certificates file bundled with httplib2. |
| 194 CA_CERTS = os.path.join( | 194 CA_CERTS = os.path.join( |
| 195 os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt") | 195 os.path.dirname(os.path.abspath( |
| 196 __file__.decode(sys.getfilesystemencoding()))), "cacerts.txt") |
| 196 | 197 |
| 197 # Which headers are hop-by-hop headers by default | 198 # Which headers are hop-by-hop headers by default |
| 198 HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authoriza
tion', 'te', 'trailers', 'transfer-encoding', 'upgrade'] | 199 HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authoriza
tion', 'te', 'trailers', 'transfer-encoding', 'upgrade'] |
| 199 | 200 |
| 200 def _get_end2end_headers(response): | 201 def _get_end2end_headers(response): |
| 201 hopbyhop = list(HOP_BY_HOP) | 202 hopbyhop = list(HOP_BY_HOP) |
| 202 hopbyhop.extend([x.strip() for x in response.get('connection', '').split(','
)]) | 203 hopbyhop.extend([x.strip() for x in response.get('connection', '').split(','
)]) |
| 203 return [header for header in response.keys() if header not in hopbyhop] | 204 return [header for header in response.keys() if header not in hopbyhop] |
| 204 | 205 |
| 205 URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?") | 206 URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?") |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 self[key.lower()] = value | 1630 self[key.lower()] = value |
| 1630 self.status = int(self.get('status', self.status)) | 1631 self.status = int(self.get('status', self.status)) |
| 1631 self.reason = self.get('reason', self.reason) | 1632 self.reason = self.get('reason', self.reason) |
| 1632 | 1633 |
| 1633 | 1634 |
| 1634 def __getattr__(self, name): | 1635 def __getattr__(self, name): |
| 1635 if name == 'dict': | 1636 if name == 'dict': |
| 1636 return self | 1637 return self |
| 1637 else: | 1638 else: |
| 1638 raise AttributeError, name | 1639 raise AttributeError, name |
| OLD | NEW |