def setUp(self): self.log = getHttpLogger('test') self.environ = { 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/test/stuff', 'HTTP_HEADER': 'value' } self.conn = {}
def setUp(self): self.log = getHttpLogger('test') self.environ = {'REQUEST_METHOD': 'GET', 'PATH_INFO': '/test/stuff', 'HTTP_HEADER': 'value'} self.conn = {}
from six.moves import cPickle from six.moves.urllib.parse import urlsplit, urljoin, urlencode import gevent from slimta.http import get_connection from slimta import logging from . import CloudStorageError __all__ = [ 'RackspaceError', 'RackspaceCloudAuth', 'RackspaceCloudFiles', 'RackspaceCloudQueues' ] log = logging.getHttpLogger(__name__) _DEFAULT_AUTH_ENDPOINT = 'https://identity.api.rackspacecloud.com/v2.0/' _DEFAULT_CLIENT_ID = str(uuid.uuid5(uuid.NAMESPACE_DNS, getfqdn())) _TIMESTAMP_HDR = 'X-Object-Meta-Timestamp' _ATTEMPTS_HDR = 'X-Object-Meta-Attempts' _DELIVERED_RCPTS_HDR = 'X-Object-Meta-Delivered-Rcpts' class RackspaceError(CloudStorageError): """Thrown when an unexpected status has been returned from a Rackspace Cloud API request and the engine does not know how to continue. """ def __init__(self, response):
import gevent from gevent import socket from gevent.queue import PriorityQueue, Empty from gevent.event import AsyncResult import six from slimta import logging from slimta.smtp.reply import Reply from slimta.http import get_connection from . import PermanentRelayError, TransientRelayError from .pool import RelayPool, RelayPoolClient from .smtp import SmtpRelayError __all__ = ['HttpRelay'] log = logging.getHttpLogger(__name__) class HttpRelayClient(RelayPoolClient): reply_code_pattern = re.compile(r'^\s*(\d\d\d)\s*;') reply_param_pattern = re.compile(r'\s(\w+)\s*=\s*"(.*?)"') def __init__(self, relay): super(HttpRelayClient, self).__init__(relay.queue, relay.idle_timeout) self.conn = None self.url = urllib_parse.urlsplit(relay.url, 'http') self.relay = relay def _wait_for_request(self): result, envelope = self.poll()