本文整理汇总了Python中ebaysdk.config.Config类的典型用法代码示例。如果您正苦于以下问题:Python Config类的具体用法?Python Config怎么用?Python Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Config类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
if self.config.get('https') and self.debug:
print("HTTPS is not supported on the Shopping API.")
示例2: __init__
def __init__(self, **kwargs):
"""Inventory Management class constructor.
Keyword arguments:
domain -- API endpoint (default: api.ebay.com)
config_file -- YAML defaults (default: ebay.yaml)
debug -- debugging enabled (default: False)
warnings -- warnings enabled (default: False)
uri -- API endpoint uri (default: /selling/inventory/v1)
token -- eBay application/user token
version -- version number (default: 1.0.0)
https -- execute of https (required by this API) (default: True)
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', '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', 'api.ebay.com'))
self.config.set('uri', '/selling/inventory/v1')
self.config.set('https', True)
self.config.set('warnings', True)
self.config.set('errors', True)
self.config.set('siteid', None)
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', 'InventoryManagement')
self.config.set(
'doc_url', 'http://developer.ebay.com/Devzone/store-pickup/InventoryManagement/index.html')
self.datetime_nodes = ['starttimefrom', 'timestamp', 'starttime',
'endtime']
self.base_list_nodes = [
]
示例3: __init__
def __init__(self, **kwargs):
"""Trading class constructor.
Keyword arguments:
domain -- API endpoint (default: api.ebay.com)
config_file -- YAML defaults (default: ebay.yaml)
debug -- debugging enabled (default: False)
warnings -- warnings enabled (default: False)
uri -- API endpoint uri (default: /ws/api.dll)
appid -- eBay application id
devid -- eBay developer id
certid -- eBay cert id
token -- eBay application/user token
siteid -- eBay country site id (default: 0 (US))
compatibility -- version number (default: 648)
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
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', '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', 'api.ebay.com'))
self.config.set('uri', '/ws/api.dll')
self.config.set('warnings', True)
self.config.set('errors', True)
self.config.set('https', True)
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('token', None)
self.config.set('iaf_token', None)
self.config.set('appid', None)
self.config.set('devid', None)
self.config.set('certid', None)
self.config.set('version', '837')
self.config.set('compatibility', '837')
示例4: __init__
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)
示例5: __init__
def __init__(self, **kwargs):
"""Trading class constructor.
Keyword arguments:
domain -- API endpoint (default: api.ebay.com)
config_file -- YAML defaults (default: ebay.yaml)
debug -- debugging enabled (default: False)
warnings -- warnings enabled (default: False)
uri -- API endpoint uri (default: /ws/api.dll)
appid -- eBay application id
devid -- eBay developer id
certid -- eBay cert id
token -- eBay application/user token
siteid -- eBay country site id (default: 0 (US))
compatibility -- version number (default: 648)
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
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', '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', 'api.ebay.com'))
self.config.set('uri', '/ws/api.dll')
self.config.set('warnings', True)
self.config.set('errors', True)
self.config.set('https', True)
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('token', None)
self.config.set('iaf_token', None)
self.config.set('appid', None)
self.config.set('devid', None)
self.config.set('certid', None)
self.config.set('compatibility', '837')
self.config.set('doc_url', 'http://developer.ebay.com/devzone/xml/docs/reference/ebay/index.html')
self.datetime_nodes = [
'shippingtime',
'starttime',
'endtime',
'scheduletime',
'createdtime',
'hardexpirationtime',
'invoicedate',
'begindate',
'enddate',
'startcreationtime',
'endcreationtime',
'endtimefrom',
'endtimeto',
'updatetime',
'lastupdatetime',
'lastmodifiedtime',
'modtimefrom',
'modtimeto',
'createtimefrom',
'createtimeto',
'starttimefrom',
'starttimeto',
'timeto',
'paymenttimefrom',
'paymenttimeto',
'inventorycountlastcalculateddate',
'registrationdate',
'timefrom',
'timestamp',
'messagecreationtime',
'resolutiontime',
'date',
'bankmodifydate',
'creditcardexpiration',
'creditcardmodifydate',
'lastpaymentdate',
'submittedtime',
'announcementstarttime',
'eventtime',
'periodicstartdate',
'modtime',
'expirationtime',
'creationtime',
'lastusedtime',
'disputecreatedtime',
'disputemodifiedtime',
'externaltransactiontime',
'commenttime',
'lastbidtime',
'time',
#.........这里部分代码省略.........
示例6: Connection
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))
#.........这里部分代码省略.........
示例7: Connection
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',
#.........这里部分代码省略.........
示例8: __init__
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'
]
示例9: Connection
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:
#.........这里部分代码省略.........
示例10: __init__
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",
"finditemsbyimageresponse.aspectfilter.aspectvaluename",
"finditemsbykeywordsresponse.aspectfilter.aspectvaluename",
"finditemsbyproductresponse.aspectfilter.aspectvaluename",
"finditemsinebaystoresresponse.aspectfilter.aspectvaluename",
"findcompleteditemsresponse.searchresult.item",
"finditemsadvancedresponse.searchresult.item",
"finditemsbycategoryresponse.searchresult.item",
"finditemsbyimageresponse.searchresult.item",
"finditemsbykeywordsresponse.searchresult.item",
"finditemsbyproductresponse.searchresult.item",
"finditemsinebaystoresresponse.searchresult.item",
"findcompleteditemsresponse.domainfilter.domainname",
"finditemsadvancedresponse.domainfilter.domainname",
"finditemsbycategoryresponse.domainfilter.domainname",
"finditemsbyimageresponse.domainfilter.domainname",
"finditemsbykeywordsresponse.domainfilter.domainname",
"finditemsinebaystoresresponse.domainfilter.domainname",
"findcompleteditemsresponse.itemfilter.value",
"finditemsadvancedresponse.itemfilter.value",
"finditemsbycategoryresponse.itemfilter.value",
"finditemsbyimageresponse.itemfilter.value",
"finditemsbykeywordsresponse.itemfilter.value",
"finditemsbyproductresponse.itemfilter.value",
"finditemsinebaystoresresponse.itemfilter.value",
"findcompleteditemsresponse.conditionhistogramcontainer.conditionhistogram",
"finditemsadvancedresponse.conditionhistogramcontainer.conditionhistogram",
"finditemsbycategoryresponse.conditionhistogramcontainer.conditionhistogram",
#.........这里部分代码省略.........
示例11: Connection
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'
]
#.........这里部分代码省略.........
示例12: Connection
#.........这里部分代码省略.........
<ErrorCode>99.99</ErrorCode>
<SeverityCode>Error</SeverityCode>
<ErrorClassification>RequestError</ErrorClassification>
</Errors>
<ResponseCode>null</ResponseCode>
<Version>653</Version>
</Response>
</soapenv:Body>
</soapenv:Envelope>
"""
def __init__(self, **kwargs):
"""Inventory Management class constructor.
Keyword arguments:
domain -- API endpoint (default: api.ebay.com)
config_file -- YAML defaults (default: ebay.yaml)
debug -- debugging enabled (default: False)
warnings -- warnings enabled (default: False)
uri -- API endpoint uri (default: /selling/inventory/v1)
token -- eBay application/user token
version -- version number (default: 1.0.0)
https -- execute of https (required by this API) (default: True)
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', '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', 'api.ebay.com'))
self.config.set('uri', '/selling/inventory/v1')
self.config.set('https', True)
self.config.set('warnings', True)
self.config.set('errors', True)
self.config.set('siteid', None)
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', 'InventoryManagement')
self.config.set('doc_url', 'http://developer.ebay.com/Devzone/store-pickup/InventoryManagement/index.html')
self.datetime_nodes = ['starttimefrom', 'timestamp', 'starttime',
'endtime']
self.base_list_nodes = [
]
endpoints = {
'addinventorylocation': 'locations/delta/add',
'addinventory': 'inventory/delta/add',
'deleteinventory': 'inventory/delta/delete',
'deleteinventorylocation': 'locations/delta/delete',
}
示例13: Connection
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',
#.........这里部分代码省略.........
示例14: __init__
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',
'finditemsbyimageresponse.aspectfilter.aspectvaluename',
'finditemsbykeywordsresponse.aspectfilter.aspectvaluename',
'finditemsbyproductresponse.aspectfilter.aspectvaluename',
'finditemsinebaystoresresponse.aspectfilter.aspectvaluename',
'findcompleteditemsresponse.searchresult.item',
'finditemsadvancedresponse.searchresult.item',
'finditemsbycategoryresponse.searchresult.item',
'finditemsbyimageresponse.searchresult.item',
'finditemsbykeywordsresponse.searchresult.item',
'finditemsbyproductresponse.searchresult.item',
'finditemsinebaystoresresponse.searchresult.item',
'findcompleteditemsresponse.domainfilter.domainname',
'finditemsadvancedresponse.domainfilter.domainname',
'finditemsbycategoryresponse.domainfilter.domainname',
'finditemsbyimageresponse.domainfilter.domainname',
'finditemsbykeywordsresponse.domainfilter.domainname',
'finditemsinebaystoresresponse.domainfilter.domainname',
'findcompleteditemsresponse.itemfilter.value',
'finditemsadvancedresponse.itemfilter.value',
'finditemsbycategoryresponse.itemfilter.value',
'finditemsbyimageresponse.itemfilter.value',
'finditemsbykeywordsresponse.itemfilter.value',
'finditemsbyproductresponse.itemfilter.value',
'finditemsinebaystoresresponse.itemfilter.value',
'findcompleteditemsresponse.conditionhistogramcontainer.conditionhistogram',
'finditemsadvancedresponse.conditionhistogramcontainer.conditionhistogram',
'finditemsbycategoryresponse.conditionhistogramcontainer.conditionhistogram',
'finditemsbyimageresponse.conditionhistogramcontainer.conditionhistogram',
#.........这里部分代码省略.........