Introduction to Ebay API with python: The Merchandising API - Part 4 - LinuxConfig.org

The Ebay Merchandising API is the focus of this fourth and last article of the series dedicated to python and Ebay APIs.
This is a companion discussion topic for the original entry at https://linuxconfig.org/introduction-to-ebay-api-with-python-the-merchandising-api-part-4

once I replace results = api.execute(‘getMostWatchedItems’, {}) with
results = api.execute(‘getMostWatchedItems’, {‘categoryId’: ‘1249’}), I am having error:

for item in results.reply.itemRecommendations.item:
^

IndentationError: unexpected indent

However, it works well if it doesn’t search for categoryId. Can u pls help?
Thanks,

Hi artgod1,
The error you receive seems to be caused by wrong indentation. Can you please paste the complete code snippet? It would be easier to help you.

Thank you.

Hi there,

pls check the code below :

#!/usr/bin/env python3
from ebaysdk.merchandising import Connection

if name == ‘main’:
api = Connection(config_file=‘ebay.yaml’)
results = api.execute(‘getMostWatchedItems’, {‘categoryId’: ‘1249’})

for item in results.reply.itemRecommendations.item:
    print(f"The item {item.title} has been watched {item.watchCount} times")

Now I am having now the error:

File “most.py”, line 9
print(f"The item {item.title} has been watched {item.watchCount} times")
^
SyntaxError: invalid syntax

Thanks for your help

Pls ignore my last message. I just fixed it
Thanks for your help