~ubuntu-branches/ubuntu/trusty/python-boto/trusty

« back to all changes in this revision

Viewing changes to boto/sdb/connection.py

  • Committer: Package Import Robot
  • Author(s): Eric Evans
  • Date: 2012-04-15 20:21:21 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120415202121-3fpf6q355s0xqpyu
Tags: 2.3.0-1
* New upstream release (Closes: #664478)
* Update debian/watch for Boto's move to Github.  Thanks Scott
  Moser. (Closes: #650480)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import xml.sax
23
23
import threading
 
24
import boto
24
25
from boto import handler
25
26
from boto.connection import AWSQueryConnection
26
27
from boto.sdb.domain import Domain, DomainMetaData
32
33
    """
33
34
    A threaded :class:`Item <boto.sdb.item.Item>` retriever utility class. 
34
35
    Retrieved :class:`Item <boto.sdb.item.Item>` objects are stored in the
35
 
    ``items`` instance variable after 
36
 
    :py:meth:`run() <run>` is called. 
 
36
    ``items`` instance variable after :py:meth:`run() <run>` is called.
37
37
    
38
 
    .. tip:: 
39
 
        The item retrieval will not start until the 
40
 
        :func:`run() <boto.sdb.connection.ItemThread.run>` method is called.
 
38
    .. tip:: The item retrieval will not start until
 
39
        the :func:`run() <boto.sdb.connection.ItemThread.run>` method is called.
41
40
    """
42
41
    def __init__(self, name, domain_name, item_names):
43
42
        """
87
86
                 is_secure=True, port=None, proxy=None, proxy_port=None,
88
87
                 proxy_user=None, proxy_pass=None, debug=0,
89
88
                 https_connection_factory=None, region=None, path='/',
90
 
                 converter=None):
 
89
                 converter=None, security_token=None):
91
90
        """
92
91
        For any keywords that aren't documented, refer to the parent class,
93
92
        :py:class:`boto.connection.AWSAuthConnection`. You can avoid having
95
94
        via :py:func:`boto.connect_sdb`.
96
95
    
97
96
        :type region: :class:`boto.sdb.regioninfo.SDBRegionInfo`
98
 
        :keyword region: Explicitly specify a region. Defaults to ``us-east-1`` 
99
 
            if not specified.
 
97
        :keyword region: Explicitly specify a region. Defaults to ``us-east-1``
 
98
            if not specified. You may also specify the region in your ``boto.cfg``:
 
99
 
 
100
            .. code-block:: cfg
 
101
 
 
102
                [SDB]
 
103
                region = eu-west-1
 
104
 
100
105
        """
101
106
        if not region:
102
 
            region = SDBRegionInfo(self, self.DefaultRegionName,
103
 
                                   self.DefaultRegionEndpoint)
 
107
            region_name = boto.config.get('SDB', 'region', self.DefaultRegionName)
 
108
            for reg in boto.sdb.regions():
 
109
                if reg.name == region_name:
 
110
                    region = reg
 
111
                    break
 
112
 
104
113
        self.region = region
105
114
        AWSQueryConnection.__init__(self, aws_access_key_id,
106
115
                                    aws_secret_access_key,
107
116
                                    is_secure, port, proxy,
108
117
                                    proxy_port, proxy_user, proxy_pass,
109
118
                                    self.region.endpoint, debug,
110
 
                                    https_connection_factory, path)
 
119
                                    https_connection_factory, path,
 
120
                                    security_token=security_token)
111
121
        self.box_usage = 0.0
112
122
        self.converter = converter
113
123
        self.item_cls = Item