mozilla / active-data-recipes

A repository of various activedata queries and recipes
Mozilla Public License 2.0
8 stars 24 forks source link

Add --debug to open a query in ActiveData's query tool #17 #35

Closed TrangNguyenBC closed 5 years ago

TrangNguyenBC commented 5 years ago

Thank @klahnakoski for detailed information. I followed it and made a modification. And I have some concerns: 1) When I tried to run the query, the command is "adr query" instead of "adr-query"; 2) I used FAKE_CONTEXT["debug"] = args.debug; but not sure it is a good solution or not 3) When opening a browser, I tried to use args.url, it stores "http://activedata.allizom.org/query" (which is the same with the url in the guide) but it didn't work, so I tried "http://activedata.allizom.org/tools/query.html" instead. Thank you.

ahal commented 5 years ago

1) When I tried to run the query, the command is "adr query" instead of "adr-query";

This is fine, a commit recently landed that changed this. So you are correct, it's now called adr query.

2) I used FAKE_CONTEXT["debug"] = args.debug; but not sure it is a good solution or not

I don't think you need to put 'debug' in the context, it should be irrelevant to the queries that are being run.

3) When opening a browser, I tried to use args.url, it stores "http://activedata.allizom.org/query" (which is the same with the url in the guide) but it didn't work, so I tried "http://activedata.allizom.org/tools/query.html" instead. Thank you.

Yes, that is the correct URL

Thanks for your PR! I'll try to take a look soon and I'll let you know if there are any changes that need to be made.

TrangNguyenBC commented 5 years ago

Thank you very much @ahal. Please let me know what I should change/improve.

TrangNguyenBC commented 5 years ago

Thank you @ahal I updated the code: 1) Add a 'time.sleep(2)' into query.py 2) Use urlparse(ACTIVE_DATA_URL) to get the url 3) Add a parameter in this method def run_query(name, debug=False, **context): instead of using context. Please help me to have a look and tell me if I should change. Thank you.

ahal commented 5 years ago

Thanks for your contribution!