cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to use the eBay API to see the historical prices of a particular product?

Hi, I have been using the Finding API to perform some searches on the eBay site, so far I have this code:

 

import json
import pandas as pd
from ebaysdk.finding import Connection as finding
from bs4 import BeautifulSoup
from config import app_id

Keywords = input('Enter your keyword/s Ex: Thinkpad t470:''\n')
api = finding(appid = app_id, siteid='EBAY-US', config_file=None)
api_request = { 'keywords': Keywords, 'outputSelector' : 'SellerInfo' }
response = api.execute('findItemsByKeywords', api_request)
soup = BeautifulSoup(response.content, 'lxml')
totalentries = int(soup.find('totalentries').text)
items = soup.find_all('item')

# Create a list to store data
data = []
def res_print():
    for item in items:
        title = item.title.string.lower().strip()
        price = int(round(float(item.currentprice.string)))
        url = item.viewitemurl.string.lower()
        seller = item.sellerusername.text.lower()
        listingtype = item.listingtype.string.lower()
       
       # Check if the listing type is fixed price
        if listingtype == 'fixedprice':
            # Add data to the list as dictionaries
            data.append({
                'Title': title,
                'Price': price,
                'URL': url,
                'Seller': seller,
                'Listing Type': listingtype
            })

# Sort the items by price from lowest to highest
items.sort(key=lambda x: float(x.currentprice.string))
res_print()

# Create a DataFrame from the dictionary list
df = pd.DataFrame(data)

# Export the DataFrame as a CSV file
df.to_csv('ebay_results.csv', index=False)

dfStyler = df.style.set_properties(**{'text-align''left'})
dfStyler.set_table_styles([dict(selector='th', props=[('text-align''left')])])

 

However now I need to see the historical prices of each product listed once I run the code. Can someone tell me if it is possible to do it?

 

Thank you very much.

Message 1 of 1
latest reply
0 REPLIES 0