Table Of Contents

Previous topic

Object

Next topic

Middleware

This Page

Misc

ACLs

Buffered HTTP

Monkey Patch httplib.HTTPResponse to buffer reads of headers. This can improve performance when making large numbers of small HTTP requests. This module also provides helper functions to make HTTP connections using BufferedHTTPResponse.

Warning

If you use this, be sure that the libraries you are using do not access the socket directly (xmlrpclib, I’m looking at you :/), and instead make all calls through httplib.

class swift.common.bufferedhttp.BufferedHTTPConnection(host, port=None, strict=None, timeout=<object object at 0x7f026a5750c0>, source_address=None)

Bases: httplib.HTTPConnection

HTTPConnection class that uses BufferedHTTPResponse

response_class

alias of BufferedHTTPResponse

class swift.common.bufferedhttp.BufferedHTTPResponse(sock, debuglevel=0, strict=0, method=None)

Bases: httplib.HTTPResponse

HTTPResponse class that buffers reading of headers

nuke_from_orbit()

Terminate the socket with extreme prejudice.

Closes the underlying socket regardless of whether or not anyone else has references to it. Use this when you are certain that nobody else you care about has a reference to this socket.

swift.common.bufferedhttp.http_connect(ipaddr, port, device, partition, method, path, headers=None, query_string=None, ssl=False)

Helper function to create an HTTPConnection object. If ssl is set True, HTTPSConnection will be used. However, if ssl=False, BufferedHTTPConnection will be used, which is buffered for backend Swift services.

Parameters:
  • ipaddr – IPv4 address to connect to
  • port – port to connect to
  • device – device of the node to query
  • partition – partition on the device
  • method – HTTP method to request (‘GET’, ‘PUT’, ‘POST’, etc.)
  • path – request path
  • headers – dictionary of headers
  • query_string – request query string
  • ssl – set True if SSL should be used (default: False)
Returns:

HTTPConnection object

swift.common.bufferedhttp.http_connect_raw(ipaddr, port, method, path, headers=None, query_string=None, ssl=False)

Helper function to create an HTTPConnection object. If ssl is set True, HTTPSConnection will be used. However, if ssl=False, BufferedHTTPConnection will be used, which is buffered for backend Swift services.

Parameters:
  • ipaddr – IPv4 address to connect to
  • port – port to connect to
  • method – HTTP method to request (‘GET’, ‘PUT’, ‘POST’, etc.)
  • path – request path
  • headers – dictionary of headers
  • query_string – request query string
  • ssl – set True if SSL should be used (default: False)
Returns:

HTTPConnection object

Constraints

Container Sync Realms

Direct Client

Exceptions

exception swift.common.exceptions.ChunkReadTimeout(seconds=None, exception=None)

Bases: eventlet.timeout.Timeout

exception swift.common.exceptions.ChunkWriteTimeout(seconds=None, exception=None)

Bases: eventlet.timeout.Timeout

exception swift.common.exceptions.ClientException(msg, http_scheme='', http_host='', http_port='', http_path='', http_query='', http_status=0, http_reason='', http_device='', http_response_content='')

Bases: exceptions.Exception

exception swift.common.exceptions.ConnectionTimeout(seconds=None, exception=None)

Bases: eventlet.timeout.Timeout

exception swift.common.exceptions.DiskFileCollision

Bases: swift.common.exceptions.DiskFileError

exception swift.common.exceptions.DiskFileDeleted(metadata=None)

Bases: swift.common.exceptions.DiskFileNotExist

exception swift.common.exceptions.DiskFileDeviceUnavailable

Bases: swift.common.exceptions.DiskFileError

exception swift.common.exceptions.DiskFileError

Bases: swift.common.exceptions.SwiftException

exception swift.common.exceptions.DiskFileExpired(metadata=None)

Bases: swift.common.exceptions.DiskFileDeleted

exception swift.common.exceptions.DiskFileNoSpace

Bases: swift.common.exceptions.DiskFileError

exception swift.common.exceptions.DiskFileNotExist

Bases: swift.common.exceptions.DiskFileError

exception swift.common.exceptions.DiskFileNotOpen

Bases: swift.common.exceptions.DiskFileError

exception swift.common.exceptions.DiskFileQuarantined

Bases: swift.common.exceptions.DiskFileError

exception swift.common.exceptions.DriveNotMounted

Bases: swift.common.exceptions.SwiftException

exception swift.common.exceptions.DuplicateDeviceError

Bases: swift.common.exceptions.RingBuilderError

exception swift.common.exceptions.EmptyRingError

Bases: swift.common.exceptions.RingBuilderError

exception swift.common.exceptions.ListingIterError

Bases: swift.common.exceptions.SwiftException

exception swift.common.exceptions.ListingIterNotAuthorized(aresp)

Bases: swift.common.exceptions.ListingIterError

exception swift.common.exceptions.ListingIterNotFound

Bases: swift.common.exceptions.ListingIterError

exception swift.common.exceptions.LockTimeout(seconds=None, msg=None)

Bases: swift.common.exceptions.MessageTimeout

exception swift.common.exceptions.MessageTimeout(seconds=None, msg=None)

Bases: eventlet.timeout.Timeout

exception swift.common.exceptions.PathNotDir

Bases: exceptions.OSError

exception swift.common.exceptions.ReplicationException

Bases: exceptions.Exception

exception swift.common.exceptions.ReplicationLockTimeout(seconds=None, msg=None)

Bases: swift.common.exceptions.LockTimeout

exception swift.common.exceptions.RingBuilderError

Bases: swift.common.exceptions.SwiftException

exception swift.common.exceptions.RingValidationError

Bases: swift.common.exceptions.RingBuilderError

exception swift.common.exceptions.SegmentError

Bases: swift.common.exceptions.SwiftException

exception swift.common.exceptions.SwiftException

Bases: exceptions.Exception

Internal Client

Manager

MemCacheD

Request Helpers

Swob

Utils

WSGI