Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

AttributeError: 'str' object has no attribute 'ProductCategoryId' #226

@azmanomer

Description

@azmanomer

Hello i tried lots of things but i couldnt manage to reach attributes :( i'm trying with this code;

from mws import mws
access_key = 'xxxxx'#replace with your access key
seller_id = 'xxxxx'#replace with your seller id
secret_key = 'xxxxxx'#replace with your secret key
marketplace_usa = 'ATVPDKIKX0DER'

products_api = mws.Products(access_key, secret_key, seller_id, region='US')
products = products_api.get_product_categories_for_asin(marketplaceid=marketplace_usa, asin='B086DPR1G2')
print(products.parsed)
for self_category in products.parsed:
    print(self_category.ProductCategoryId, self_category.ProductCategoryName)

product.parsed return "{'Self': {'ProductCategoryId': {'value': '3422301'}, 'ProductCategoryName': {'value': 'Mats'}, 'Parent': {'ProductCategoryId': {'value': '3422251'}, 'ProductCategoryName': {'value': 'Yoga'}, 'Parent': {'ProductCategoryId': {'value': '3407731'}, 'ProductCategoryName': {'value': 'Exercise & Fitness'}, 'Parent': {'ProductCategoryId': {'value': '10971181011'}, 'ProductCategoryName': {'value': 'Sports & Fitness'}, 'Parent': {'ProductCategoryId': {'value': '3375301'}, 'ProductCategoryName': {'value': 'Categories'}, 'Parent': {'ProductCategoryId': {'value': '3375251'}, 'ProductCategoryName': {'value': 'Sports & Outdoors'}}}}}}}}" it has ProductCategoryId but it still give me error AttributeError: 'str' object has no attribute 'ProductCategoryId'

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions