question

maga2041 avatar image
0 Likes"
maga2041 asked ·

Connection Refused Error

Hi, I am also getting the Connection Refused error; sometimes I get Connection reset by peer. Previously my code is working fine but now it started throwing connection refused error after several hits. Can someone please help me how to fix it? Following is my code- header = {'User-Agent':'Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1'} opener = urllib2.build_opener() keyword_search_list.next() try: for row in keyword_search_list: '''For new data points''' keywrd1 = row[1] keywrd = str(row[1]).replace(" ","%20").replace("","").replace("","").replace("","") url1 = " http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findCompletedItems&SERVICE-VERSION=1.13.0&SECURITY-APPNAME="+str(appid1)+"&RESPONSE-DATA-FORMAT=json&REST-PAYLOAD&keywords="+str(keywrd)+"⁢emFilter(0).name=soldItemsOnly⁢emFilter(0).value=True&PaginationInput.entriesPerPage=100&paginationInput.pageNumber=1"; url=url1 req = urllib2.Request(str(url),headers=header) resp = opener.open(req) data = json.loads(resp.read()) total_entries = data['findCompletedItemsResponse'][0]['paginationOutput'][0]['totalEntries'][0] if int(total_entries) > 0: product_list = data['findCompletedItemsResponse'][0]['searchResult'][0]['item'] get_details(product_list) # Parsing Json data total_entries = data['findCompletedItemsResponse'][0]['paginationOutput'][0]['totalEntries'][0] total_pages = data['findCompletedItemsResponse'][0]['paginationOutput'][0]['totalPages'][0] if int(total_pages) > 1: for pg in range(int(total_pages)-1): next_url = " http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findCompletedItems&SERVICE-VERSION=1.13.0&SECURITY-APPNAME="+str(appid1)+"&RESPONSE-DATA-FORMAT=json&REST-PAYLOAD&keywords="+str(keywrd)+"⁢emFilter(0).name=soldItemsOnly⁢emFilter(0).value=True&PaginationInput.entriesPerPage=100&paginationInput.pageNumber="+str(pg+2) req1 = urllib2.Request(str(next_url),headers=header) resp1 = opener.open(req1) data1 = json.loads(resp1.read()) product_list1 = data1['findCompletedItemsResponse'][0]['searchResult'][0]['item'] get_details(product_list1) else: print "No products found in "+keywrd except: traceback.print_exc()
finding apipythonebay apiconnection errorconnection refusederror 111web scraping
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.