Skip to content
matecsaj edited this page Jun 12, 2020 · 2 revisions

This HTML class can be used to make traditional HTTP/REST calls.

##Usage

from ebaysdk.http import Connection as HTTP

try:
    api = HTTP()
    response = api.execute('https://github.com/timotheus/ebaysdk-python/wiki.atom')
    print(response.dict())
except ConnectionError as e:
    print(e)
    print(e.response.content)

Public Methods

HTTP(**kwargs)

Keyword arguments to HTTP() constructor

debug         -- debugging enabled (default: False)
method        -- GET/POST/PUT (default: GET)
proxy_host    -- proxy hostname
proxy_port    -- proxy port number
timeout       -- HTTP request timeout (default: 20)
parallel      -- ebaysdk parallel object

execute(verb, data)

Execute the HTTP request.

api.execute('https://github.com/timotheus/ebaysdk-python/wiki.atom', {'arg1': 'val1'})

error()

Returns a string of the HTTP call errors

if api.error():
    print "has errors: %s" % api.error()

response.dom()

Return a DOM object (lxml dom) of the HTTP response content.

response.dict()

Return a dictionary of the HTTP response content.

response.content

Return the string content from the HTTP response call.

response_code()

Return the HTTP response code.

response_status()

Return the HTTP response status.

Clone this wiki locally