Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6: Support for webservice version in cli and flask api endpoint #41

Closed
wants to merge 1 commit into from

Conversation

agussman
Copy link

This creates a new option to return the version of the webservice via a service command.

Note that I dropped the use of --version since the service endpoint only returns one thing at this point.

Copy link
Owner

@pylipp pylipp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this! Looks great already :) Makes a lot of sense too, to not have --version yet.
Please have a look at the travis build if still failing after you implemented the review changes.
Also, can you add a small test to test_cli (in CliFlaskTestCase) to ensure code coverage?

Another thing I thought about was changing the command name to webservice since it's not supported when people use it with the 'none' service (which could still be considered a service, albeit fake). This also brings me to the question how to handle the command with the none service. With the current way, Server.run() would return an error. Either we tell the user that the service/webservice command is only to be used with the flask service; or we add support for the service command when the 'none' service is used. I tend towards having a webservice command; and giving an error at cli module level if anyone tries to invoke it while the none service is configured to be used.

@@ -63,5 +63,9 @@ def create_app(data_dir=None, config=None):
EntryResource,
"{}/<period_name>/<table_name>/<eid>".format(PERIODS_TAIL),
resource_class_args=(server,))
api.add_resource(
VersionResource,
'/version'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you introduce a constant VERSION_TAIL in financeager/__init__.py for the /version part; and also substitute the use in the httprequests module?

@@ -120,3 +122,9 @@ class CopyResource(LogResource):
def post(self):
args = copy_parser.parse_args()
return self.run_safely("copy", error_code=404, **args)


class VersionResource(Resource):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you derive the class from LogResource. This automatically logs the incoming request which can be helpful for debugging.

class VersionResource(Resource):
def get(self):
val = {'version': __version__}
return val
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can shorten this to return {...}.
Also please add the missing EOF (it's one thing the travis build complained about).

@pylipp pylipp mentioned this pull request Oct 26, 2019
@pylipp
Copy link
Owner

pylipp commented Dec 12, 2021

Closed in pylipp/financeager-flask@7164e6b

@pylipp pylipp closed this Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants