Conversation
2245c60 to
61c3bc4
Compare
|
|
||
| class SSO(object): | ||
| def __init__(self): | ||
| required_settings = ['api_key', 'project_id', ] |
There was a problem hiding this comment.
Nit: don't think you need the trailing comma.
There was a problem hiding this comment.
I typically would prefer it for lists and dicts, habit. For multiline dicts and lists, diffs are cleaner. For lists, this also protects us from accidental implicit string concatenation as well.
There was a problem hiding this comment.
Is there a linter/formatter we can use for our Python stuff so style comments don't need to come up in code reviews?
We use Rubocop for Ruby, which enforces and autofixes coding style. And on the Typescript side, we're using Prettier.
There was a problem hiding this comment.
Could be interesting to use black, I've heard the most yelling about that at klaviyo. Looks like it's modeled off of prettier. I think the draw to using black is the lack of configuration for the most part and how hard lined it is.
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
========================================
- Coverage 100% 93.5% -6.5%
========================================
Files 1 5 +4
Lines 2 77 +75
========================================
+ Hits 2 72 +70
- Misses 0 5 +5
Continue to review full report at Codecov.
|
89d2f1b to
2ff9b49
Compare
2ff9b49 to
0799ebe
Compare
marktran
left a comment
There was a problem hiding this comment.
👍 not a Pythonista but this seems to cover SSO as far as I can tell
I'll leave it to @rjvani to approve
rohanjadvani
left a comment
There was a problem hiding this comment.
Few minor suggestions, but LGTM otherwise 🎉
README.md
Outdated
| # workos-python | ||
| API Client for WorkOS No newline at end of file | ||
|
|
||
| Pyhon SDK to conveniently access the [WorkOS] API(https://workos.com). |
There was a problem hiding this comment.
Super nit, but I think for markdown you might need to do WorkOS API.
|
|
||
| def test_initialize_sso_missing_api_key(self, set_project_id): | ||
| with pytest.raises(ConfigurationException): | ||
| client.sso |
There was a problem hiding this comment.
Nit: don't have to, but can be more explicit if you want to case on the setting that's missing
tests/test_client.py
Outdated
| with pytest.raises(ConfigurationException): | ||
| client.sso | ||
|
|
||
|
No newline at end of file |
There was a problem hiding this comment.
Can maybe also add a test if both are missing
workos/__init__.py
Outdated
|
|
||
| api_key = None | ||
| project_id = None | ||
| base_api_url = BASE_API_URL No newline at end of file |
There was a problem hiding this comment.
I don't really have a strong opinion here, but since the variable is used only once, can directly set base_api_url to the string.
There was a problem hiding this comment.
I'd be down for that
| Returns: | ||
| WorkOSProfile: The WorkOS profile of a User | ||
| ''' | ||
| profile_data = response['profile'] |
There was a problem hiding this comment.
Maybe use get in case of potential KeyError?
There was a problem hiding this comment.
Not sure how I'd want the user to encounter this just yet but I at the very least would want an exception because something I'm expecting isn't there
|
|
||
| profile = cls() | ||
| for field in WorkOSProfile.OBJECT_FIELDS: | ||
| setattr(profile, field, profile_data[field]) |
There was a problem hiding this comment.
Same here, would consider using get
Overview
Initial package with SSO functionality