mozilla / active-data-recipes

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

Have ADR accept --url parameter? #16

Closed klahnakoski closed 6 years ago

klahnakoski commented 6 years ago

There are multiple ActiveData endpoints, and they have different data. If ADR can accept a --url parameter then it can send queries to other endpoints.

ahal commented 6 years ago

To expand on this a bit, adr currently hardcodes the ActiveData url here: https://github.com/mozilla/active-data-recipes/blob/13ff63d60def86d4df062209800d6f838c6cf11e/adr/query.py#L20

But there are several ActiveData instances running (e.g a prod/dev instance, a bugzilla instance) and we might want to query one vs the other.

The currently hardcoded endpoint should still be the default, but we want the ability to specify other arbitrary instances. So this bug will involve adding a new argument to cli.py and figuring out how to propagate that to the url used in query.py.

nadaa commented 6 years ago

Hi @ahal, I came from Outreachy, and I would love to start with this if possible?

ahal commented 6 years ago

Welcome @nadaa !

Sure, you are welcome to give this a try. Please feel free to ask if you have any questions or would like clarification on anything.

nadaa commented 6 years ago

Thanks a lot, Mr. @ahal. I am trying to understand the process, so we need to allow users to enter the URL in the command line beside the query, if there is no URL, the default one will be used? The default URL is used for what?

ahal commented 6 years ago

Exactly, we want people to be able to run adr <recipe> (which will use the default URL), as well as adr <recipe> --url <url> (which will use the URL they specify).

The URL is where we submit the query to active data. It is currently defined here: https://github.com/mozilla/active-data-recipes/blob/13ff63d60def86d4df062209800d6f838c6cf11e/adr/query.py#L20

But we'll have to figure out how to modify that with the value provided on the command line. I'd recommend reading up on the argparse module if you aren't familiar with it. Hope that helps!

nadaa commented 6 years ago

Alright, thank you :)

ahal commented 6 years ago

You're welcome :)

A good first step would be to make sure you can install the module and run a recipe. It'll help you get a feel for how it's supposed to work. You can also check out the contributing guide if you haven't already: https://github.com/mozilla/active-data-recipes/blob/master/CONTRIBUTING.md

nadaa commented 6 years ago

I sent a pull request, please let me know if it needs any modification. Thanks!