Home httplib.InvalidURL: nonnumeric port: '//api.ebay.com/ws/api.dll'
Reply: 0

httplib.InvalidURL: nonnumeric port: '//api.ebay.com/ws/api.dll'

user1848
1#
user1848 Published in May 20, 2018, 10:09 am

I try to run an example from the book collective intelligence, but I had an error httplib.InvalidURL: nonnumeric port: '//api.ebay.com/ws/api.dll'

serverUrl = 'https://api.ebay.com/ws/api.dll'

def sendRequest(apicall, xmlparameters):
connection = httplib.HTTPSConnection(serverUrl)  <-- Error here
connection.request("POST", '/ws/api.dll', xmlparameters,
                   getHeaders(apicall))
response = connection.getresponse()
if response.status != 200:
    print("Ошибка при отправке запроса:" + response.reason)
else:
    data = response.read()
    connection.close()
return data



def doSearch(query, categoryID=None, page=1):
xml = "<?xml version='1.0' encoding='utf-8'?>" + \
      "<GetSearchResultsRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">" + \
      "<RequesterCredentials><eBayAuthToken>" + \
      userToken + \
      "</eBayAuthToken></RequesterCredentials>" + \
      "<Pagination>" + \
      "<EntriesPerPage>200</EntriesPerPage>" + \
      "<PageNumber>" + str(page) + "</PageNumber>" + \
      "</Pagination>" + \
      "<Query>" + query + "</Query>"
if categoryID != None:
    xml += "<CategoryID>" + str(categoryID) + "</CategoryID>"
xml += "</GetSearchResultsRequest>"
data = sendRequest('GetSearchResults', xml)
response = parseString(data)
itemNodes = response.getElementsByTagName('Item')
results = []
for item in itemNodes:
    itemId = getSingleValue(item, 'ItemID')
    itemTitle = getSingleValue(item, 'Title')
    itemPrice = getSingleValue(item, 'CurrentPrice')
    itemEnds = getSingleValue(item, 'EndTime')
    results.append((itemId, itemTitle, itemPrice, itemEnds))
return results

Help me please solve this problem

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298023 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO