maga2041 avatar image
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() try: for row in keyword_search_list: '''For new data points''' keywrd1 = row[1] keywrd = str(row[1]).replace(" ","%20").replace("","").replace("","").replace("","") url1 = ""+str(appid1)+"&RESPONSE-DATA-FORMAT=json&REST-PAYLOAD&keywords="+str(keywrd)+"&itemFilter(0).name=soldItemsOnly&itemFilter(0).value=True&PaginationInput.entriesPerPage=100&paginationInput.pageNumber=1" url=url1 req = urllib2.Request(str(url),headers=header) resp = data = json.loads( 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 = ""+str(appid1)+"&RESPONSE-DATA-FORMAT=json&REST-PAYLOAD&keywords="+str(keywrd)+"&itemFilter(0).name=soldItemsOnly&itemFilter(0).value=True&PaginationInput.entriesPerPage=100&paginationInput.pageNumber="+str(pg+2) req1 = urllib2.Request(str(next_url),headers=header) resp1 = data1 = json.loads( 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 errorerror 111connection refusedweb scraping
10 |600

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

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.