Closed kracekumar closed 6 years ago
Not much to add myself.
I agree with Krace that moving URLs to single location is useful, see also: https://github.com/minds-ai/zoom-drive-connector/blob/00e4c10e78b5346a4ec1153765023dcb5baa81ae/drive/drive_api.py#L42 .
We might want to use the same bin/git
and style_check.sh
/.pylintrc
/.pycodestyle
as in the other repositories.
Lots of typing with list
, dict
, etc., but normally you would use typing's List
and Dict
etc.
Maybe run:
pip install pipreqs pip-tools
pipreqs --force ./; mv requirements.txt requirements.in; pip-compile
to get a more reproducible set of dependencies (with versions).
From a security perspective, I don't know if it is great to have a plain readable config.yaml
that gives access to drive, zoom, and slack.
Thanks for the comments, everyone. Most of this stuff should be fairly easy to fix, though I have a couple of comments.
https://github.com/minds-ai/zoom-drive-connector/blob/master/main.py#L32. The function returns a list, should be annotated as List[Dict[str, str]]. If you find difficult to annotate a dict, consider using namedtuple.
@kracekumar I generally like to avoid namedtuples due to performance considerations (slow startup times). This is a fairly small application so it wouldn't matter here, but it's a practice I like to follow.
In terms of docstrings, I've been writing them in reStructured Text format (as recommended by PEP 287). The reason for this is that this repository was started before we had a stated company-wide docstring format. As a consequence, most of the Python code written by IT uses this format now. I think this is part of a bigger discussion on whether to migrate IT's docstring formatting to something else.
@jvanheugten In terms of having access keys and credentials in a file, there's a tradeoff to be made here: either keeping everything on disk or using environment variables (which get logged in your shell history anyway). The configuration file will likely be in someone's home folder which should only be accessible by one person.
So here's a preliminary todo list. Feel free to comment on this so I can add stuff.
All changes applied in #16 and #17.
@jbedorf and @MrFlynn. The overall code looks good. There are few minor suggested changes by me. @jvanheugten please add your reviews too. Please feel to modify or ignore. Though, I haven't tested the workflow by setting up the repo.
Typing
List[Dict[str, str]]
. If you find difficult to annotate a dict, consider using namedtuple.Dict[]
and notdict
.date
andfilename
in the dictionary can be None on failure, and helps to maintain the same structure.Requests
the above code can be written as
Response API: http://docs.python-requests.org/en/master/api/#requests.Response
General
'HTTP_STATUS: {c}-{n}, {m}'.format(c=self.status_code, n=self.name, m=self.message)
rather than format string you can consider using f-string likef'HTTP_STATUS: {self.status_code}-{self.name}, {self.message}'
.__repr__
prints object creation method likePipeline(steps=[(a, A())])
. https://docs.python.org/3/library/functions.html#repr. https://github.com/minds-ai/zoom-drive-connector/blob/master/zoom/zoom_api_exception.py#L47this repo follows
class ZoomURLS(Enum): recordings: 'https://api.zoom.us/v2/meetings/{id}/recordings' delete_recordings: 'https://api.zoom.us/v2/meetings/{id}/recordings/{rid}' ...