Closed bensLine closed 8 years ago
Yes there is. This is due to a request from the maps team that the map wont get overloaded with Pokémon. In the response there is a flag "limited" which tells you if it had been cut off or not. If yes you should lower the time range. Do this until it is not limited and then query the neighboring time interval with the same method
hmm, this seems a bit tricky. finding the right timespan by several requests is time-consuming and the wrong approach for that, in my opinion. Can you not provide a parameter limited
which is by default true
and we can set it to false
, so the map team won't be affected.
We would en up with something like this: http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/api/pokemon/sighting/ts/2016-09-14T08:00:00.000Z/range/1d?limited=false
well this would allow anyone to make arbitrary big request to our server. My idea would be to communicate a secret api key and with that key you will be able to receive responses unlimited in size. Would implement if @sacdallago approves this.
@bensLine , @jonas-he is right, that would open up a pretty dangerous behavior. Of course, if someone wants to get all the data all they need to do is send multiple requests with different timestamps, but that requires more work and DDosing the server, which will block them.
If you can implement a GET parameter (or better, header) containing a token
which will validate the requester, that is a good enough security measure for now :)
oh I see, thanks for the update!
@bensLine @sacdallago will implement tomorrow
@bensLine @sacdallago it's done, see #193. Once this is merged the API at http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/ will be "unlimited" provided you know the token which is publicly available in this github repo. But i guess @sacdallago will be shutting this down soon anyways. So @bensLine should switch over to the API at predictemall.online
Thanks @jonas-he . Have a small change request in your PR
@sacdallago done
@jonas-he 🙈
@jonas-he thanks for the implementation! :) I just wanted to test it, but I get a 502 for https://predictemall.online/api/pokemon/sighting/ts/2016-11-01T08:00:00.000Z/range/1h ad the old API is down as you mentioned. Do you know if there is a running API currently?
Nope you have to ask @sacdallago about the status of the API
ok, thanks!
Not really, the latest deployment broke the container:
[pokedatadevelop-1]2016-11-07T07:07:41.726450999Z npm info it worked if it ends with ok
[pokedatadevelop-1]2016-11-07T07:07:41.727811739Z npm info using npm@2.14.2
[pokedatadevelop-1]2016-11-07T07:07:41.728444895Z npm info using node@v4.0.0
[pokedatadevelop-1]2016-11-07T07:07:42.904858049Z npm info prestart pokemongo-api@0.0.1
[pokedatadevelop-1]2016-11-07T07:07:42.941744903Z npm info start pokemongo-api@0.0.1
[pokedatadevelop-1]2016-11-07T07:07:42.946630669Z
[pokedatadevelop-1]2016-11-07T07:07:42.946667642Z > pokemongo-api@0.0.1 start /usr/src/app
[pokedatadevelop-1]2016-11-07T07:07:42.946674266Z > NODE_ENV=production node app.js
[pokedatadevelop-1]2016-11-07T07:07:42.946689918Z
[pokedatadevelop-1]2016-11-07T07:07:50.020635738Z 2016-11-07T07:07:49.987Z started prediction script, init DC
[pokedatadevelop-1]2016-11-07T07:07:50.026570802Z fs.js:549
[pokedatadevelop-1]2016-11-07T07:07:50.026605857Z return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
[pokedatadevelop-1]2016-11-07T07:07:50.026618937Z ^
[pokedatadevelop-1]2016-11-07T07:07:50.026624811Z
[pokedatadevelop-1]2016-11-07T07:07:50.026629680Z Error: ENOENT: no such file or directory, open '/usr/src/app/node_modules/predict-pokemonprediction_feature_config.json'
[pokedatadevelop-1]2016-11-07T07:07:50.026650768Z at Error (native)
[pokedatadevelop-1]2016-11-07T07:07:50.026656315Z at Object.fs.openSync (fs.js:549:18)
[pokedatadevelop-1]2016-11-07T07:07:50.026661239Z at Object.fs.readFileSync (fs.js:397:15)
[pokedatadevelop-1]2016-11-07T07:07:50.026666295Z at fileToJson (/usr/src/app/node_modules/predict-pokemon/dataSet_creator.js:364:23)
[pokedatadevelop-1]2016-11-07T07:07:50.026671683Z at Object.DC.init (/usr/src/app/node_modules/predict-pokemon/dataSet_creator.js:30:22)
[pokedatadevelop-1]2016-11-07T07:07:50.026690748Z at /usr/src/app/node_modules/predict-pokemon/prediction.js:41:8
[pokedatadevelop-1]2016-11-07T07:07:50.026697357Z at Object.<anonymous> (/usr/src/app/node_modules/predict-pokemon/prediction.js:263:3)
[pokedatadevelop-1]2016-11-07T07:07:50.026702793Z at Module._compile (module.js:434:26)
[pokedatadevelop-1]2016-11-07T07:07:50.026707226Z at Object.Module._extensions..js (module.js:452:10)
[pokedatadevelop-1]2016-11-07T07:07:50.026736200Z at Module.load (module.js:355:32)
[pokedatadevelop-1]2016-11-07T07:07:50.026743785Z at Function.Module._load (module.js:310:12)
[pokedatadevelop-1]2016-11-07T07:07:50.026748186Z at Module.require (module.js:365:17)
[pokedatadevelop-1]2016-11-07T07:07:50.026752309Z at require (module.js:384:17)
[pokedatadevelop-1]2016-11-07T07:07:50.026756842Z at Object.<anonymous> (/usr/src/app/app/api/sighting.js:4:20)
[pokedatadevelop-1]2016-11-07T07:07:50.026761735Z at Module._compile (module.js:434:26)
[pokedatadevelop-1]2016-11-07T07:07:50.026766083Z at Object.Module._extensions..js (module.js:452:10)
[pokedatadevelop-1]2016-11-07T07:07:51.074654282Z
[pokedatadevelop-1]2016-11-07T07:07:51.098053066Z npm info pokemongo-api@0.0.1 Failed to exec start script
[pokedatadevelop-1]2016-11-07T07:07:51.098337075Z npm ERR! Linux 4.4.0-42-generic
[pokedatadevelop-1]2016-11-07T07:07:51.098826806Z npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
[pokedatadevelop-1]2016-11-07T07:07:51.099217175Z npm ERR! node v4.0.0
[pokedatadevelop-1]2016-11-07T07:07:51.099637946Z npm ERR! npm v2.14.2
[pokedatadevelop-1]2016-11-07T07:07:51.100102290Z npm ERR! code ELIFECYCLE
[pokedatadevelop-1]2016-11-07T07:07:51.100521810Z npm ERR! pokemongo-api@0.0.1 start: `NODE_ENV=production node app.js`
[pokedatadevelop-1]2016-11-07T07:07:51.100791150Z npm ERR! Exit status 1
[pokedatadevelop-1]2016-11-07T07:07:51.101071172Z npm ERR!
[pokedatadevelop-1]2016-11-07T07:07:51.101421899Z npm ERR! Failed at the pokemongo-api@0.0.1 start script 'NODE_ENV=production node app.js'.
[pokedatadevelop-1]2016-11-07T07:07:51.101790140Z npm ERR! This is most likely a problem with the pokemongo-api package,
[pokedatadevelop-1]2016-11-07T07:07:51.102139520Z npm ERR! not with npm itself.
[pokedatadevelop-1]2016-11-07T07:07:51.103145004Z npm ERR! Tell the author that this fails on your system:
[pokedatadevelop-1]2016-11-07T07:07:51.104269882Z npm ERR! NODE_ENV=production node app.js
[pokedatadevelop-1]2016-11-07T07:07:51.104963878Z npm ERR! You can get their info via:
[pokedatadevelop-1]2016-11-07T07:07:51.113246038Z npm ERR! npm owner ls pokemongo-api
[pokedatadevelop-1]2016-11-07T07:07:51.113678360Z npm ERR! There is likely additional logging output above.
[pokedatadevelop-1]2016-11-07T07:07:51.124612824Z
[pokedatadevelop-1]2016-11-07T07:07:51.130326765Z npm ERR! Please include the following file with any support request:
[pokedatadevelop-1]2016-11-07T07:07:51.180667374Z npm ERR! /usr/src/app/npm-debug.log
still missing files errors. This is due to the PR being merged before the problem was fixed.
are sure it's the latest version? since the error refers to this line
DC.init(__dirname + '/prediction_feature_config.json', true);
which is fixed in the latest package (yesterday evening).
I'll trigger the build on docker hub again. If the service restarts, problem solved.
@sacdallago - The package version was updated and merged just now. So the next docker build should reflect the latest changes.
Hey guys,
is there a limit for the sightings request? I always receive only 1000 entries for a request like: http://pokedata.c4e3f8c7.svc.dockerapp.io:65014/api/pokemon/sighting/ts/2016-09-14T08:00:00.000Z/range/1d But we actually need all entries of the day.