marvinody / mercari

a wrapper around mercari jp shopping site
43 stars 15 forks source link

The program encountered an error. Has Mercari updated their API? #20

Closed rennefhl closed 1 year ago

rennefhl commented 1 year ago

I noticed that the program is no longer functioning and raises the following error:

Traceback (most recent call last):

  File "F:\ProgramData\Anaconda3\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)

  File "F:\ProgramData\Anaconda3\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)

  File "F:\ProgramData\Anaconda3\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())

  File "F:\ProgramData\Anaconda3\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Expecting value

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "D:\Users\Compressed\mercari-master_3\mercari-master\run.py", line 10, in <module>
    for item in mercari.search("東方 ふもふも"):

  File "D:\Users\Compressed\mercari-master_3\mercari-master\mercari\mercari.py", line 95, in search
    items, has_next_page = fetch(searchURL, data)

  File "D:\Users\Compressed\mercari-master_3\mercari-master\mercari\mercari.py", line 74, in fetch
    return parse(r.json())

  File "F:\ProgramData\Anaconda3\lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value

The code was working fine yesterday, but it started throwing errors today. How can I resolve this? Thank you.

marvinody commented 1 year ago

Yes, I'm also seeing this. They just changed something recently. Looking into this and I'll get back to this thread once I (hopefully) find a fix.

marvinody commented 1 year ago

Quick update, yes. They have updated a lot of stuff in their search API. At first glance, it looks like I can make some updates to get it working again, but I'm going to make some breaking changes in the search function, so you may have to update your code down the road.

rennefhl commented 1 year ago

Thank you very much for your reply. I tried to fix it myself but couldn't solve it. Looking forward to your code update. Thank you.

marvinody commented 1 year ago

Whoops, it auto-closed this. Reopening to make sure it works for you.

pip install mercari==2.0.0

I've updated the readme in case you need to make some code changes if you were using parameters other than the default. I didn't heavily test this besides my own use-case so let me know if you encounter any issues. If everything looks good, I'll close this.

rennefhl commented 1 year ago

Whoops, it auto-closed this. Reopening to make sure it works for you.

pip install mercari==2.0.0

I've updated the readme in case you need to make some code changes if you were using parameters other than the default. I didn't heavily test this besides my own use-case so let me know if you encounter any issues. If everything looks good, I'll close this.

The program can run correctly now. Thank you very much for your help.