当前位置: 首页>>代码示例>>Python>>正文


Python Config.get方法代码示例

本文整理汇总了Python中ebaysdk.config.Config.get方法的典型用法代码示例。如果您正苦于以下问题:Python Config.get方法的具体用法?Python Config.get怎么用?Python Config.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ebaysdk.config.Config的用法示例。


在下文中一共展示了Config.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Connection

# 需要导入模块: from ebaysdk.config import Config [as 别名]
# 或者: from ebaysdk.config.Config import get [as 别名]
class Connection(BaseConnection):
    """Connection class for the Finding service

    API documentation:
    https://www.x.com/developers/ebay/products/finding-api

    Supported calls:
    findItemsAdvanced
    findItemsByCategory
    (all others, see API docs)

    Doctests:
    >>> f = Connection(config_file=os.environ.get('EBAY_YAML'))
    >>> retval = f.execute('findItemsAdvanced', {'keywords': 'shoes'})
    >>> error = f.error()
    >>> print(error)
    None
    >>> if not f.error():
    ...   print(f.response_obj().itemSearchURL != '')
    ...   items = f.response_obj().searchResult.item
    ...   print(len(items))
    ...   print(f.response_dict().ack)
    True
    100
    Success

    """

    def __init__(self, **kwargs):
        """Finding class constructor.

        Keyword arguments:
        domain        -- API endpoint (default: svcs.ebay.com)
        config_file   -- YAML defaults (default: ebay.yaml)
        debug         -- debugging enabled (default: False)
        warnings      -- warnings enabled (default: False)
        uri           -- API endpoint uri (default: /services/search/FindingService/v1)
        appid         -- eBay application id
        siteid        -- eBay country site id (default: EBAY-US)
        compatibility -- version number (default: 1.0.0)
        https         -- execute of https (default: False)
        proxy_host    -- proxy hostname
        proxy_port    -- proxy port number
        timeout       -- HTTP request timeout (default: 20)
        parallel      -- ebaysdk parallel object
        response_encoding -- API encoding (default: XML)
        request_encoding  -- API encoding (default: XML)
        """

        super(Connection, self).__init__(method='POST', **kwargs)

        self.config=Config(domain=kwargs.get('domain', 'svcs.ebay.com'),
                           connection_kwargs=kwargs,
                           config_file=kwargs.get('config_file', 'ebay.yaml'))

        # override yaml defaults with args sent to the constructor
        self.config.set('domain', kwargs.get('domain', 'svcs.ebay.com'))
        self.config.set('uri', '/services/search/FindingService/v1')
        self.config.set('https', False)
        self.config.set('warnings', True)
        self.config.set('errors', True)
        self.config.set('siteid', 'EBAY-US')
        self.config.set('response_encoding', 'XML')
        self.config.set('request_encoding', 'XML')
        self.config.set('proxy_host', None)
        self.config.set('proxy_port', None)
        self.config.set('token', None)
        self.config.set('iaf_token', None)
        self.config.set('appid', None)
        self.config.set('version', '1.12.0')
        self.config.set('compatibility', '1.0.0')
        self.config.set('service', 'FindingService')

    def build_request_headers(self, verb):
        return {
            "X-EBAY-SOA-SERVICE-NAME": self.config.get('service', ''),
            "X-EBAY-SOA-SERVICE-VERSION": self.config.get('version', ''),
            "X-EBAY-SOA-SECURITY-APPNAME": self.config.get('appid', ''),
            "X-EBAY-SOA-GLOBAL-ID": self.config.get('siteid', ''),
            "X-EBAY-SOA-OPERATION-NAME": verb,
            "X-EBAY-SOA-REQUEST-DATA-FORMAT": self.config.get('request_encoding', ''),
            "X-EBAY-SOA-RESPONSE-DATA-FORMAT": self.config.get('response_encoding', ''),
            "Content-Type": "text/xml"
        }

    def build_request_data(self, verb, data):
        xml = "<?xml version='1.0' encoding='utf-8'?>"
        xml += "<" + verb + "Request xmlns=\"http://www.ebay.com/marketplace/search/v1/services\">"
        xml += to_xml(data) or ''
        xml += "</" + verb + "Request>"

        return xml

    def warnings(self):
        warning_string = ""

        if len(self._resp_body_warnings) > 0:
            warning_string = "%s: %s" \
                % (self.verb, ", ".join(self._resp_body_warnings))

#.........这里部分代码省略.........
开发者ID:itemfire,项目名称:ebaysdk-python,代码行数:103,代码来源:__init__.py

示例2: Connection

# 需要导入模块: from ebaysdk.config import Config [as 别名]
# 或者: from ebaysdk.config.Config import get [as 别名]
class Connection(BaseConnection):
    """Connection class for a base SOA service"""

    def __init__(self, app_config=None, site_id='EBAY-US', debug=False, **kwargs):
        """SOA Connection class constructor"""
        
        super(Connection, self).__init__(method='POST', debug=debug, **kwargs)

        self.config=Config(domain=kwargs.get('domain', ''),
                           connection_kwargs=kwargs,
                           config_file=kwargs.get('config_file', 'ebay.yaml'))

        self.config.set('https', False)
        self.config.set('site_id', site_id)
        self.config.set('content_type', 'text/xml;charset=UTF-8')
        self.config.set('request_encoding', 'XML')
        self.config.set('response_encoding', 'XML')
        self.config.set('message_protocol', 'SOAP12')
        self.config.set('soap_env_str', '') ## http://www.ebay.com/marketplace/fundraising/v1/services',

        ph = None
        pp = 80
        if app_config:
            self.load_from_app_config(app_config)
            ph = self.config.get('proxy_host', ph)
            pp = self.config.get('proxy_port', pp)


    # override this method, to provide setup through a config object, which
    # should provide a get() method for extracting constants we care about
    # this method should then set the .api_config[] dict (e.g. the comment below)
    def load_from_app_config(self, app_config):
        #self.api_config['domain'] = app_config.get('API_SERVICE_DOMAIN')
        #self.api_config['uri'] = app_config.get('API_SERVICE_URI')
        pass

    # Note: this method will always return at least an empty object_dict!
    #   It used to return None in some cases. If you get an empty dict,
    #   you can use the .error() method to look for the cause.
    def response_dict(self):
        return self.response.dict()

        '''
        if self._response_dict:
            return self._response_dict

        if self._response_content:

            mydict = self.response.dict()
            
            try:
                verb = self.verb + 'Response'
                self._response_dict = mydict['Envelope']['Body'][verb]

            except KeyError:
                self._response_dict = mydict.get(self.verb + 'Response', mydict)

        return self._response_dict
        '''

    def build_request_headers(self, verb):
        return {
            'Content-Type': self.config.get('content_type'),
            'X-EBAY-SOA-SERVICE-NAME': self.config.get('service'),
            'X-EBAY-SOA-OPERATION-NAME': verb,
            'X-EBAY-SOA-GLOBAL-ID': self.config.get('site_id'),
            'X-EBAY-SOA-REQUEST-DATA-FORMAT': self.config.get('request_encoding'),
            'X-EBAY-SOA-RESPONSE-DATA-FORMAT': self.config.get('response_encoding'),
            'X-EBAY-SOA-MESSAGE-PROTOCOL': self.config.get('message_protocol'),
        }

    def build_request_data(self, verb, data, verb_attrs):
        xml = '<?xml version="1.0" encoding="utf-8"?>'
        xml += '<soap:Envelope'
        xml += ' xmlns:soap="http://www.w3.org/2003/05/soap-envelope"'
        xml += ' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"'
        xml += ' xmlns:ser="%s" >' % self.config.get('soap_env_str')
        xml += '<soap:Body>'
        xml += '<ser:%sRequest>' % verb
        xml += dict2xml(self.soapify(data))
        xml += '</ser:%sRequest>' % verb
        xml += '</soap:Body>'
        xml += '</soap:Envelope>'
        return xml

    def soapify(self, xml):
        xml_type = type(xml)
        if xml_type == dict:
            soap = {}
            for k, v in list(xml.items()):
                if k == '@attrs' or k == '#text':
                    soap[k] = v
                    
                # skip nodes that have ns defined
                elif ':' in k:
                    soap[k] = self.soapify(v)
                else:
                    soap['ser:%s' % (k)] = self.soapify(v)
                
        elif xml_type == list:
#.........这里部分代码省略.........
开发者ID:Jai-Chaudhary,项目名称:ebaysdk-python,代码行数:103,代码来源:__init__.py

示例3: Connection

# 需要导入模块: from ebaysdk.config import Config [as 别名]
# 或者: from ebaysdk.config.Config import get [as 别名]
class Connection(BaseConnection):
    """Shopping API class

    API documentation:
    http://developer.ebay.com/products/shopping/

    Supported calls:
    getSingleItem
    getMultipleItems
    (all others, see API docs)

    Doctests:
    >>> s = Connection(config_file=os.environ.get('EBAY_YAML'))
    >>> retval = s.execute('FindPopularItems', {'QueryKeywords': 'Python'})
    >>> print(s.response_obj().Ack)
    Success
    >>> print(s.error())
    None
    """

    def __init__(self, **kwargs):
        """Shopping class constructor.

        Keyword arguments:
        domain        -- API endpoint (default: open.api.ebay.com)
        config_file   -- YAML defaults (default: ebay.yaml)
        debug         -- debugging enabled (default: False)
        warnings      -- warnings enabled (default: True)
        errors        -- errors enabled (default: True)
        uri           -- API endpoint uri (default: /shopping)
        appid         -- eBay application id
        siteid        -- eBay country site id (default: 0 (US))
        compatibility -- version number (default: 799)
        https         -- execute of https (default: True)
        proxy_host    -- proxy hostname
        proxy_port    -- proxy port number
        timeout       -- HTTP request timeout (default: 20)
        parallel      -- ebaysdk parallel object
        trackingid    -- ID to identify you to your tracking partner
        trackingpartnercode -- third party who is your tracking partner
        response_encoding   -- API encoding (default: XML)
        request_encoding    -- API encoding (default: XML)

        More affiliate tracking info:
        http://developer.ebay.com/DevZone/shopping/docs/Concepts/ShoppingAPI_FormatOverview.html#StandardURLParameters

        """
        super(Connection, self).__init__(method='POST', **kwargs)

        self.config=Config(domain=kwargs.get('domain', 'open.api.ebay.com'),
                           connection_kwargs=kwargs,
                           config_file=kwargs.get('config_file', 'ebay.yaml'))

        # override yaml defaults with args sent to the constructor
        self.config.set('domain', kwargs.get('domain', 'open.api.ebay.com'))
        self.config.set('uri', '/shopping')
        self.config.set('warnings', True)
        self.config.set('errors', True)
        self.config.set('https', False)
        self.config.set('siteid', '0')
        self.config.set('response_encoding', 'XML')
        self.config.set('request_encoding', 'XML')
        self.config.set('proxy_host', None)
        self.config.set('proxy_port', None)
        self.config.set('appid', None)
        self.config.set('version', '799')
        self.config.set('trackingid', None)
        self.config.set('trackingpartnercode', None)
        self.config.set('doc_url', 'http://developer.ebay.com/DevZone/Shopping/docs/CallRef/index.html')

        if self.config.get('https') and self.debug:
            print("HTTPS is not supported on the Shopping API.")

        self.datetime_nodes = ['timestamp', 'registrationdate', 'creationtime',
            'commenttime', 'updatetime', 'estimateddeliverymintime',
            'estimateddeliverymaxtime', 'creationtime', 'estimateddeliverymintime',
            'estimateddeliverymaxtime', 'endtime', 'starttime']

        self.base_list_nodes=[
            'findhalfproductsresponse.halfcatalogproduct.productid',
            'findhalfproductsresponse.halfproducts.product',
            'getshippingcostsresponse.internationalshippingserviceoption.shipsto',
            'getsingleitemresponse.itemcompatibility.compatibility',
            'getsingleitemresponse.itemcompatibility.namevaluelist',
            'getsingleitemresponse.variationspecifics.namevaluelist',
            'getsingleitemresponse.namevaluelist.value',
            'getsingleitemresponse.pictures.variationspecificpictureset',
            'getmultipleitemsresponse.pictures.variationspecificpictureset',
            'findreviewsandguidesresponse.reviewdetails.review',
            'getshippingcostsresponse.shippingdetails.internationalshippingserviceoption',
            'getshippingcostsresponse.shippingdetails.shippingserviceoption',
            'getshippingcostsresponse.shippingdetails.excludeshiptolocation',
            'getshippingcostsresponse.shippingserviceoption.shipsto',
            'findpopularitemsresponse.itemarray.item',
            'findproductsresponse.itemarray.item',
            'getsingleitemresponse.item.paymentmethods',
            'getmultipleitemsresponse.item.pictureurl',
            'getsingleitemresponse.item.pictureurl',
            'findproductsresponse.item.shiptolocations',
            'getmultipleitemsresponse.item.shiptolocations',
#.........这里部分代码省略.........
开发者ID:Holihigh,项目名称:ebaysdk-python,代码行数:103,代码来源:__init__.py

示例4: Connection

# 需要导入模块: from ebaysdk.config import Config [as 别名]
# 或者: from ebaysdk.config.Config import get [as 别名]
class Connection(BaseConnection):
    """Connection class for the Business Policies service

    API documentation:
    http://developer.ebay.com/Devzone/business-policies

    Supported calls:
    addSellerProfile
    getSellerProfiles
    (all others, see API docs)

    """

    def __init__(self, **kwargs):
        """Finding class constructor.

        Keyword arguments:
        domain        -- API endpoint (default: svcs.ebay.com)
        config_file   -- YAML defaults (default: ebay.yaml)
        debug         -- debugging enabled (default: False)
        warnings      -- warnings enabled (default: False)
        uri           -- API endpoint uri (default: /services/selling/v1/SellerProfilesManagementService)
        appid         -- eBay application id
        siteid        -- eBay country site id (default: EBAY-US)
        version       -- version number (default: 1.0.0)
        https         -- execute of https (default: False)
        proxy_host    -- proxy hostname
        proxy_port    -- proxy port number
        timeout       -- HTTP request timeout (default: 20)
        parallel      -- ebaysdk parallel object
        response_encoding -- API encoding (default: XML)
        request_encoding  -- API encoding (default: XML)
        """

        super(Connection, self).__init__(method='POST', **kwargs)

        self.config = Config(domain=kwargs.get('domain', 'svcs.ebay.com'),
                             connection_kwargs=kwargs,
                             config_file=kwargs.get('config_file', 'ebay.yaml'))

        # override yaml defaults with args sent to the constructor
        self.config.set('domain', kwargs.get('domain', 'svcs.ebay.com'))
        self.config.set('uri', '/services/selling/v1/SellerProfilesManagementService')
        self.config.set('https', True)
        self.config.set('warnings', True)
        self.config.set('errors', True)
        self.config.set('siteid', 'EBAY-US')
        self.config.set('response_encoding', 'XML')
        self.config.set('request_encoding', 'XML')
        self.config.set('proxy_host', None)
        self.config.set('proxy_port', None)
        self.config.set('token', None)
        self.config.set('iaf_token', None)
        self.config.set('appid', None)
        self.config.set('version', '1.0.0')
        self.config.set('service', 'SellerProfilesManagementService')
        self.config.set('doc_url', 'http://developer.ebay.com/Devzone/business-policies/CallRef/index.html')

        self.datetime_nodes = ['deleteddate', 'timestamp', 'maxdeliverydate',
                               'mindeliverydate']
        self.base_list_nodes = [
            'setsellerprofileresponse.paymentprofile.categorygroups.categorygroup',
            'addsellerprofileresponse.paymentprofile.categorygroups.categorygroup',
            'getsellerprofilesresponse.paymentprofilelist.paymentprofile.categorygroups.categorygroup',
            'addsellerprofileresponse.returnpolicyprofile.categorygroups.categorygroup',
            'setsellerprofileresponse.returnpolicyprofile.categorygroups.categorygroup',
            'getsellerprofilesresponse.returnpolicyprofilelist.returnpolicyprofile.categorygroups.categorygroup',
            'addsellerprofileresponse.shippingpolicyprofile.categorygroups.categorygroup',
            'setsellerprofileresponse.shippingpolicyprofile.categorygroups.categorygroup',
            'getsellerprofilesresponse.shippingpolicyprofilelist.shippingpolicyprofile.categorygroups.categorygroup',
            'consolidateshippingprofilesresponse.consolidationjob',
            'getconsolidationjobstatusresponse.consolidationjob',
            'addsellerprofileresponse.paymentprofile.paymentinfo.depositdetails',
            'setsellerprofileresponse.paymentprofile.paymentinfo.depositdetails',
            'getsellerprofilesresponse.paymentprofilelist.paymentprofile.paymentinfo.depositdetails',
            'addsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.freightshipping',
            'setsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.freightshipping',
            'getsellerprofilesresponse.shippingpolicyprofilelist.shippingpolicyprofile.shippingpolicyinfo.freightshipping',
            'addsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.insurance',
            'setsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.insurance',
            'getsellerprofilesresponse.shippingpolicyprofilelist.shippingpolicyprofile.shippingpolicyinfo.insurance',
            'addsellerprofileresponse.paymentprofile.paymentinfo',
            'setsellerprofileresponse.paymentprofile.paymentinfo',
            'getsellerprofilesresponse.paymentprofilelist.paymentprofile.paymentinfo',
            'addsellerprofileresponse.returnpolicyprofile.returnpolicyinfo',
            'setsellerprofileresponse.returnpolicyprofile.returnpolicyinfo',
            'getsellerprofilesresponse.returnpolicyprofilelist.returnpolicyprofile.returnpolicyinfo',
            'addsellerprofileresponse.sellerprofile',
            'setsellerprofileresponse.sellerprofile',
            'getsellerprofilesresponse.paymentprofilelist.sellerprofile',
            'getsellerprofilesresponse.returnpolicyprofilelist.sellerprofile',
            'getsellerprofilesresponse.shippingpolicyprofilelist.sellerprofile',
            'addsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.shippingpolicyinfoservice',
            'setsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.shippingpolicyinfoservice',
            'getsellerprofilesresponse.shippingpolicyprofilelist.shippingpolicyprofile.shippingpolicyinfo.shippingpolicyinfoservice',
            'addsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.shippingprofilediscountinfo',
            'setsellerprofileresponse.shippingpolicyprofile.shippingpolicyinfo.shippingprofilediscountinfo',
            'getsellerprofilesresponse.shippingpolicyprofilelist.shippingpolicyprofile.shippingpolicyinfo.shippingprofilediscountinfo'
        ]

#.........这里部分代码省略.........
开发者ID:BraunPhilipp,项目名称:ebaysdk-python,代码行数:103,代码来源:__init__.py

示例5: Connection

# 需要导入模块: from ebaysdk.config import Config [as 别名]
# 或者: from ebaysdk.config.Config import get [as 别名]
class Connection(BaseConnection):
    """Connection class for the Inventory Management service

    API documentation:
    http://developer.ebay.com/Devzone/store-pickup/InventoryManagement/index.html

    Supported calls:
    AddInventory
    AddInventoryLocation
    DeleteInventory
    DeleteInventoryLocation
    (all others, see API docs)

    Doctests:
    Create location first
    >>> f = Connection(config_file=os.environ.get('EBAY_YAML'), debug=False)

    Take care here, unicode string is put here specially to ensure lib can handle it properly. If not we got an error:
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 28: ordinal not in range(128)
    >>> try:
    ...     retval = f.execute(u'AddInventoryLocation', {
    ...         'Address1': u'Alexanderplatz 12 ąśćł',
    ...         'Address2': u'Gebaude 6',
    ...         'City': u'Berlin',
    ...         'Country': u'DE',
    ...         'PostalCode': u'13355',
    ...         'Latitude': u'37.374488',
    ...         'Longitude': u'-122.032876',
    ...         'LocationID': u'ebaysdk_test',
    ...         'LocationType': u'STORE',
    ...         'Phone': u'(408)408-4080',
    ...         'URL': u'http://store.com',
    ...         'UTCOffset': u'+02:00',
    ...         'Name': 'Test',
    ...         'Region': 'Berlin',
    ...         'PickupInstructions': 'Pick it up soon',
    ...         'Hours': [{'Day': {'DayOfWeek': 1, 'Interval': {'Open': '08:00:00', 'Close': '10:00:00'}}}]
    ...     })
    ...     print(f.response.reply.LocationID.lower())
    ... except ConnectionError as e:
    ...     print(f.error()) # doctest: +SKIP
    ebaysdk_test

    And now add item it it
    >>> try:
    ...     f = Connection(config_file=os.environ.get('EBAY_YAML'), debug=False)
    ...     retval = f.execute('AddInventory', {"SKU": "SKU_TEST", "Locations": {"Location": [
    ...     {"Availability": "IN_STOCK", "LocationID": "ebaysdk_test", "Quantity": 10}
    ...     ]}})
    ...     print(f.response.reply.SKU.lower())
    ... except ConnectionError as e:
    ...     print(f.error()) # doctest: +SKIP
    sku_test


    Delete item from all locations
    >>> try:
    ...     f = Connection(config_file=os.environ.get('EBAY_YAML'), debug=False)
    ...     retval = f.execute('DeleteInventory', {"SKU": "SKU_TEST", "Confirm": 'true'})
    ...     print(f.response.reply.SKU.lower())
    ... except ConnectionError as e:
    ...     print(f.error()) # doctest: +SKIP
    sku_test


    Delete location
    >>> try:
    ...     f = Connection(config_file=os.environ.get('EBAY_YAML'), debug=False)
    ...     retval = f.execute('DeleteInventoryLocation', {"LocationID": "ebaysdk_test"})
    ...     print(f.response.reply.LocationID.lower())
    ... except ConnectionError as e:
    ...     print(f.error()) # doctest: +SKIP
    ebaysdk_test


    Check errors handling
    >>> try:
    ...     f = Connection(token='WRONG TOKEN', config_file=os.environ.get('EBAY_YAML'), debug=False, errors=True)
    ...     retval = f.execute('DeleteInventoryLocation', {"LocationID": "ebaysdk_test"})
    ... except ConnectionError as e:
    ...     print(f.error()) # doctest: +SKIP
    DeleteInventoryLocation: Bad Request, Class: RequestError, Severity: Error, Code: 503, Authentication: Invalid user token Authentication: Invalid user token


    Sometimes ebay returns us really weird error message, already reported to ebay, if it will be fixed I will remove
    all special cases to handle it.
    Example of wrong response:
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
       <soapenv:Body>
          <Response>
             <Timestamp>Wed May 06 2015 02:15:49 GMT-0700 (GMT-07:00)</Timestamp>
             <Ack>Failure</Ack>
             <Errors>
                <ShortMessage>Gateway Error</ShortMessage>
                <LongMessage>Failover endpoint : Selling_Inventory_REST_SVC_V1 - no ready child endpoints</LongMessage>
                <ErrorCode>99.99</ErrorCode>
                <SeverityCode>Error</SeverityCode>
                <ErrorClassification>RequestError</ErrorClassification>
             </Errors>
#.........这里部分代码省略.........
开发者ID:bimusiek,项目名称:ebaysdk-python,代码行数:103,代码来源:__init__.py

示例6: Connection

# 需要导入模块: from ebaysdk.config import Config [as 别名]
# 或者: from ebaysdk.config.Config import get [as 别名]
class Connection(BaseConnection):
    """Connection class for the Finding service

    API documentation:
    https://www.x.com/developers/ebay/products/finding-api

    Supported calls:
    findItemsAdvanced
    findItemsByCategory
    (all others, see API docs)

    Doctests:
    >>> f = Connection(config_file=os.environ.get('EBAY_YAML'), debug=False)
    >>> retval = f.execute('findItemsAdvanced', {'keywords': u'niño'})
    >>> error = f.error()
    >>> print(error)
    None
    >>> if not f.error():
    ...   print(f.response.reply.itemSearchURL != '')
    ...   items = f.response.reply.searchResult.item
    ...   print(len(items) > 2)
    ...   print(f.response.reply.ack)
    True
    True
    Success

    """

    def __init__(self, **kwargs):
        """Finding class constructor.

        Keyword arguments:
        domain        -- API endpoint (default: svcs.ebay.com)
        config_file   -- YAML defaults (default: ebay.yaml)
        debug         -- debugging enabled (default: False)
        warnings      -- warnings enabled (default: False)
        uri           -- API endpoint uri (default: /services/search/FindingService/v1)
        appid         -- eBay application id
        siteid        -- eBay country site id (default: EBAY-US)
        version       -- version number (default: 1.0.0)
        https         -- execute of https (default: False)
        proxy_host    -- proxy hostname
        proxy_port    -- proxy port number
        timeout       -- HTTP request timeout (default: 20)
        parallel      -- ebaysdk parallel object
        response_encoding -- API encoding (default: XML)
        request_encoding  -- API encoding (default: XML)
        """

        super(Connection, self).__init__(method='POST', **kwargs)

        self.config=Config(domain=kwargs.get('domain', 'svcs.ebay.com'),
                           connection_kwargs=kwargs,
                           config_file=kwargs.get('config_file', 'ebay.yaml'))

        # override yaml defaults with args sent to the constructor
        self.config.set('domain', kwargs.get('domain', 'svcs.ebay.com'))
        self.config.set('uri', '/services/search/FindingService/v1')
        self.config.set('https', False)
        self.config.set('warnings', True)
        self.config.set('errors', True)
        self.config.set('siteid', 'EBAY-US')
        self.config.set('response_encoding', 'XML')
        self.config.set('request_encoding', 'XML')
        self.config.set('proxy_host', None)
        self.config.set('proxy_port', None)
        self.config.set('token', None)
        self.config.set('iaf_token', None)
        self.config.set('appid', None)
        self.config.set('version', '1.12.0')
        self.config.set('service', 'FindingService')
        self.config.set('doc_url', 'http://developer.ebay.com/DevZone/finding/CallRef/index.html')

        self.datetime_nodes = ['starttimefrom', 'timestamp', 'starttime',
                               'endtime']
        self.base_list_nodes = [
            'findcompleteditemsresponse.categoryhistogramcontainer.categoryhistogram',
            'finditemsadvancedresponse.categoryhistogramcontainer.categoryhistogram',
            'finditemsbycategoryresponse.categoryhistogramcontainer.categoryhistogram',
            'finditemsbyimageresponse.categoryhistogramcontainer.categoryhistogram',
            'finditemsbykeywordsresponse.categoryhistogramcontainer.categoryhistogram',
            'finditemsbyproductresponse.categoryhistogramcontainer.categoryhistogram',
            'finditemsinebaystoresresponse.categoryhistogramcontainer.categoryhistogram',
            'findcompleteditemsresponse.aspecthistogramcontainer.aspect',
            'finditemsadvancedresponse.aspecthistogramcontainer.aspect',
            'finditemsbycategoryresponse.aspecthistogramcontainer.aspect',
            'finditemsbyimageresponse.aspecthistogramcontainer.aspect',
            'finditemsbykeywordsresponse.aspecthistogramcontainer.aspect',
            'finditemsbyproductresponse.aspecthistogramcontainer.aspect',
            'finditemsinebaystoresresponse.aspecthistogramcontainer.aspect',
            'findcompleteditemsresponse.aspect.valuehistogram',
            'finditemsadvancedresponse.aspect.valuehistogram',
            'finditemsbycategoryresponse.aspect.valuehistogram',
            'finditemsbyimageresponse.aspect.valuehistogram',
            'finditemsbykeywordsresponse.aspect.valuehistogram',
            'finditemsbyproductresponse.aspect.valuehistogram',
            'finditemsinebaystoresresponse.aspect.valuehistogram',
            'findcompleteditemsresponse.aspectfilter.aspectvaluename',
            'finditemsadvancedresponse.aspectfilter.aspectvaluename',
            'finditemsbycategoryresponse.aspectfilter.aspectvaluename',
#.........这里部分代码省略.........
开发者ID:Qiucode,项目名称:ebaysdk-python,代码行数:103,代码来源:__init__.py


注:本文中的ebaysdk.config.Config.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。