alexander-pick / MKMTool

MKMTool ist a helper application I wrote for tinkering around with optimization of sale processes on magiccardmarket.eu and the idea of automisation of some tasks most people wouldn’t be able to get done by pure manpower.
GNU Affero General Public License v3.0
65 stars 15 forks source link

SQL Error when starting #6

Closed morthimer closed 5 years ago

morthimer commented 5 years ago

Hi, I have been trying to run your code.

When I downloaded the precompiled code archive it worked well, but this did not include the price update settings yet. So I checked out your code, ran it in VS but I always only get this error: error

I have been playing around for like an hour now.

Maybe you know whats the mistake.

Greetings, Martin

tomasjanak commented 5 years ago

Hi, for some reason the database of products is not built for you. It should be downloaded automatically from MKM if it does not exist, so there could be some connection issues, or maybe your config.xml does not have a valid token so MKM refuses to communicate with you? There should be an mkminventory.csv and mkminventory.zip files in your bin directory (MKMTool/bin/Release or MKMTool/bin/Debug) created automatically after it gets downloaded upon MKMTool first startup, are they there? Also, there is an mkmtool.sqlite file there, if it is created incorrectly, it would have 0 bytes as size, does it or doesn't it? Anyway, as far as I can tell it is used only for want list editing and should not affect anything else, so after OKing this message, you should be able to use all other MKMTool functionalities with no problems. Of course, if there some connection issues, you will run into other problems as well, but then at least maybe we can debug further what is wrong.

Regards, Tomas

morthimer commented 5 years ago

Hey, thanks for the quick response!

All the files were there, but I made it work after I manually deleted the 3 files. After the next start, they were re-downlaoded and then worked.

I can do all the requests now! But when I check for my "View Inventory" or let the bot start a price update I get a HTTP 403 response.

I've been checking my config.xml file twice and even renewed the tokens. May it be that it happens because I got a pretty big stock with 28k+ cards online?

[image: Unbenannt.JPG]

Thank you so much for your help!

Greetings from Austria, Martin

Am Mo., 17. Sep. 2018 um 21:26 Uhr schrieb tomasjanak < notifications@github.com>:

Hi, for some reason the database of products is not built for you. It should be downloaded automatically from MKM if it does not exist, so there could be some connection issues, or maybe your config.xml does not have a valid token so MKM refuses to communicate with you? There should be an mkminventory.csv and mkminventory.zip files in your bin directory (MKMTool/bin/Release or MKMTool/bin/Debug) created automatically after it gets downloaded upon MKMTool first startup, are they there? Also, there is an mkmtool.sqlite file there, if it is created incorrectly, it would have 0 bytes as size, does it or doesn't it? Anyway, as far as I can tell it is used only for want list editing and should not affect anything else, so after OKing this message, you should be able to use all other MKMTool functionalities with no problems. Of course, if there some connection issues, you will run into other problems as well, but then at least maybe we can debug further what is wrong.

Regards, Tomas

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alexander-pick/MKMTool/issues/6#issuecomment-422139560, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqrc_IGDrffQOTcfdTu1iXSBwXurVyBks5ub_dkgaJpZM4WgU3A .

-- -- Liebe Grüße, Martin Leitgeb

tomasjanak commented 5 years ago

Have you managed to do some updates first before you got the 403 response? If so, you probably reached your API request limits - unless you are a professional seller, you are limited only to 5000 requests per day. Updating price takes 1 request per item in your stock, so you would run out of requests easily. Moreover, you might actually get blocked by MKM from using the API (not MKM itself, that's fine) if you keep trying when you are over 5k requests. See what I wrote in this issue if you're interested in more details: https://github.com/alexander-pick/MKMTool/issues/5

Possible solution to keep using MKMTool's price update are:

  1. Get a professional account if that is feasible for you.
  2. You could easily do some small change in the code to skip updating some articles, for example you probably don't need to run the price analysis on commons, so if they are majority of your stock that would ease up things (no requests would be generated for those articles). Or you could do something like if (current_price <0.2€) don't bother; But of course this way you might miss some price spikes. Unfortunately, there isn't a way to get the trend/minimal etc. prices other than by one request per article if you are not a professional/power seller (if you are, there is a special API call for it). But at that point you are also not limited by the request count so it's moot...
morthimer commented 5 years ago

Hey, no I cant do any updates and when checking the inventory it loads for about 7 seconds, then shows the expection.

And I do have a professional account, so I think that the 50k requests should be enough. But I will test it with my secondary account to verify it its the program or the account with the big stock. In case its the account I will contact the MCM Support, maybe they can tell me anything helpful.

Thank you really much for your help! Martin

Am Di., 18. Sep. 2018 um 11:48 Uhr schrieb tomasjanak < notifications@github.com>:

Have you managed to do some updates first before you got the 403 response? If so, you probably reached your API request limits - unless you are a professional seller, you are limited only to 5000 requests per day. Updating price takes 1 request per item in your stock, so you would run out of requests easily. Moreover, you might actually get blocked by MKM from using the API (not MKM itself, that's fine) if you keep trying when you are over 5k requests. See what I wrote in this issue if you're interested in more details: #5 https://github.com/alexander-pick/MKMTool/issues/5

Possible solution to keep using MKMTool's price update are:

  1. Get a professional account if that is feasible for you.
  2. You could easily do some small change in the code to skip updating some articles, for example you probably don't need to run the price analysis on commons, so if they are majority of your stock that would ease up things (no requests would be generated for those articles). Or you could do something like if (current_price <0.2€) don't bother; But of course this way you might miss some price spikes. Unfortunately, there isn't a way to get the trend/minimal etc. prices other than by one request per article if you are not a professional/power seller (if you are, there is a special API call for it). But at that point you are also not limited by the request count so it's moot...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alexander-pick/MKMTool/issues/6#issuecomment-422329145, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqrc3h2bpZAZidIZ-iy-hdzi8LF7zlfks5ucMFigaJpZM4WgU3A .

-- -- Liebe Grüße, Martin Leitgeb

tomasjanak commented 5 years ago

In that case I am not sure what else might be wrong, the 403 code is reserved as a "forbidden access" code (https://api.cardmarket.com/ws/documentation/API_2.0:Response_Codes), so if you did not use up your requests and your token is valid (did you get a token for "dedicated app"?) you'll probably have to ask the MKM's support. Heads-up advice: don't start with "I am using some software somebody else did as a dedicated app and I am getting 403 response", they will ignore your question and instead respond with "We don't support developers and applications that request our users to provide their complete API credentials of dedicated apps to log-in through these apps. These credentials are the very same as your normal account username and password for the website log-in on Cardmarket.com. They are enough to commit fraud using your name. " and it will take some time to explain to them that you are actually not providing your credentials to anybody. I would just say "I have made a simple app for myself to update the prices but when I try to use it I get 403, what am I doing wrong". Good luck.

Tomas

morthimer commented 5 years ago

Hi, thanks for the advice! I got the codes all correct and it works all nice and smooth on my "small" private account but still not on my commercial one.

I'll keep you updated with the support replies.

Thank you again and greetings Martin

Am Di., 18. Sep. 2018 um 14:32 Uhr schrieb tomasjanak < notifications@github.com>:

In that case I am not sure what else might be wrong, the 403 code is reserved as a "forbidden access" code ( https://api.cardmarket.com/ws/documentation/API_2.0:Response_Codes), so if you did not use up your requests and your token is valid (did you get a token for "dedicated app"?) you'll probably have to ask the MKM's support. Heads-up advice: don't start with "I am using some software somebody else did as a dedicated app and I am getting 403 response", they will ignore your question and instead respond with "We don't support developers and applications that request our users to provide their complete API credentials of dedicated apps to log-in through these apps. These credentials are the very same as your normal account username and password for the website log-in on Cardmarket.com. They are enough to commit fraud using your name. " and it will take some time to explain to them that you are actually not providing your credentials to anybody. I would just say "I have made a simple app for myself to update the prices but when I try to use it I get 403, what am I doing wrong". Good luck.

Tomas

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alexander-pick/MKMTool/issues/6#issuecomment-422373129, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqrc8jTqFJMbuPNcTUd-UybLIIU6Au_ks5ucOffgaJpZM4WgU3A .

-- -- Liebe Grüße, Martin Leitgeb

friscoMad commented 5 years ago

@morthimer There is a new limit since 24th July that block all inventory request with more than 1K items, this leads to the 403 error, I did a PR (#7) to fix the issue.