Exemplo n.º 1
0
    for keyword in content:
				# search for a sold auction item which contains the keyword and the payment was done in USD
        api.execute('findCompletedItems', {
            'keywords': keyword,
            'itemFilter': [
                {'name': 'ListingType',
                 'value': 'Auction'},
                {'name': 'Currency',
                 'value': 'USD'},                
                {'name': 'SoldItemsOnly',
                 'value': 'true'},                 
            ],        
            'sortOrder': 'StartTimeNewest',
            })

        response = json.loads(api.response_json())
        items = response['searchResult']['item']
        count = int(response['searchResult']['count']['value'])
        
        for x in range(0,count):
						# get the item information
            item = getItemDetails(int(items[x]['itemId']['value']))
            if item != 'null':
                ground_truth.append(item)
								# store the pictures
                path = str(len(ground_truth)) + "/"
                if not os.path.exists(path):
                    os.makedirs(path)
                urllib.urlretrieve(item[5][0], path + "image_1.jpg")
                urllib.urlretrieve(item[5][1], path + "image_2.jpg")
                urllib.urlretrieve(item[5][2], path + "image_3.jpg")