ahivert / tgtg-python

Unofficial client for TooGoodToGo API
GNU General Public License v3.0
377 stars 73 forks source link

Cannot cancel order, unauthorized #310

Closed Klausoleum closed 2 months ago

Klausoleum commented 2 months ago

I've been trying to cancel an order made with the API for a few days so I can then buy it again in the app.

client.abort_order(order_id) order_status = tooGoodToGo.client.get_order_status(order_id)

Unfortunately, canceling doesn't work. I get the following error back: 403, b'{"errors":[{"code":"UNAUTHORIZED"}]} why should it be unauthorized? I then check the status of the order. Debug: {'id': 'abc', 'item_id': '12335', 'user_id': 'xyz', 'state': 'RESERVED'} the order is still reserved. is there a limit on attempts to cancel an order? Is it possible that I will be on the blacklist for a certain period of time?

Klausoleum commented 2 months ago

I noticed the following:

When I start tgtg, the version is displayed 3 times at intervals of several seconds.

Screenshot 2024-08-13 225651

If I run the abort_order() function after the first time the version is displayed, everything works fine. After the second and third time, I get the error:

403, b'{"errors":[{"code":"UNAUTHORIZED"}]}

The create_order() function is not affected by this. It can always be started successfully.

I think I am using the current version of tgtg. Screenshot 2024-08-13 225824

The project I am using uses the Telegram frontend from #https://github.com/TorbenStriegel/TooGoodToGo-TelegramBot

Is it normal that the version is displayed 3 times? And why does abort_order() only work the first time?

Klausoleum commented 2 months ago

The problem is probably solved. I have completely reinstalled the project. Now the version number is only displayed once. Canceling the order runs smoothly.

It is not known why the instance was started three times or its version number was displayed three times.