abarran02 / ShopGoodwill

Python package for interfacing with ShopGoodwill.com
MIT License
2 stars 0 forks source link

show_categories() throws RuntimeError because `categoryListModel` is not returned in response data #2

Open allardbrain opened 1 year ago

allardbrain commented 1 year ago

Hey Alec, really great work you've done on this package! I've been playing around with it locally and I've run into an issue when trying to make this foundational call:

from shopgoodwill_pkg.src.ShopGoodwill import ShopGoodwill

sgw = ShopGoodwill()
sgw.show_categories(show_children=False)

It's triggering the RuntimeError described here in ShopGoodwill.py:

raise RuntimeWarning('Failed to retrieve and parse ShopGoodwill sellers or categories. Check your internet connection.')

Since I was able to run example.py just fine, I was skeptical that this was truly a RuntimeError. I put in a bunch of pdb statements and was able to track down the cause of the issue.

The data that's returned here returns a huge list of locations, but does not contain any category information at all. Thus, the needed categoryListModel and categoryModel keys shown below are missing from the dictionary.

https://github.com/abarran02/ShopGoodwill/blob/cbae9397ab7e38ff8b3dab752275dcbd61570d83/src/ShopGoodwill/ShopGoodwill.py#L154

I'd be happy to submit a PR to fix this if you could give me some direction on how to access the categoryListModel from another web page on their site, perhaps? I'm not sure how I'd go about finding that.

Thanks!

allardbrain commented 1 year ago

The serverApp-state script seems to only contain location info. I'm not seeing any category info there when I inspect the HTML in the Browser inspector.

allardbrain commented 1 year ago

If you don't have time to look into this now, could you perhaps copy-paste a list of categories and their integer IDs into the README?