andreagrandi/covid-api

Empty json

safadig opened this issue · 8 comments

curl -X GET "http://localhost:8000/v1/daily-reports/?limit=100" -H "accept: application/json" returns empty json
could not tell if I needed to add more keys to request?

curl -X GET "http://localhost:8000/v1/daily-reports/?limit=100" -H "accept: application/json" returns empty json
could not tell if I needed to add more keys to request?

hi, how did you import the data? At the moment the procedure is a bit tricky. You need to import it first and then move the sqlite db in the same folder where app.py is. We will move away from SQLite soon.

hi, how did you import the data? At the moment the procedure is a bit tricky. You need to import it first and then move the sqlite db in the same folder where app.py is. We will move away from SQLite soon.

Did not import..Basically using Pycharm, created virt env and installed requirements and got API up...not sure what steps are needed after that..Thanks

@safadig try running python import_data.py from within the covidapi subdirectory. That should create covidapi/covid-reports.db which you can then copy over to the root directory as @andreagrandi describes above.

@andreagrandi shall I make a PR for that change (moving to postgres)? I can have a look at what else we need to do to get this running on heroku as well.

@MatMoore that would be great, thanks! It's probably easier to explain how to connect to PostgreSQL than do all these tricks with paths, moving files etc....

Shall we open a separate discussion for data import?

Sounds good to me.

I've just opened #19 for the postgres part.

@MatMoore running python import_data.py from within covidapi creates covidapi/covid-reports.db and self creates another copy under covid-api-master/covid-reports.db which is parent of covidapi/ All three files app.py import_data.py and covid-reports.db are in the same covidapi/ directory

With the above ..I am still getting empty json

Hi @safadig, I've just merged a change to use postgres instead of SQLite. Can you pull the latest change and see if the instructions in the readme work for you now? This will eliminate the need for covid-reports.db.

@MatMoore running python import_data.py from within covidapi creates covidapi/covid-reports.db and self creates another copy under covid-api-master/covid-reports.db which is parent of covidapi/ All three files app.py import_data.py and covid-reports.db are in the same covidapi/ directory

With the above ..I am still getting empty json

Hi @safadig did Mat reply help you to run the code? I'm closing this for now because SQLite issue is now obsolete since we moved to PostgreSQL