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

Update sample apps for Python SDK v5 #59

Merged
merged 31 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
152b941
Update home page on sample app for 5.0
tribble Jul 16, 2024
320abf0
Updates and fixes
tribble Jul 16, 2024
480d240
Add views for user and group details
tribble Jul 16, 2024
e0e094d
API tweaks
tribble Jul 16, 2024
c92e84b
Add guards to satisfy typing
tribble Jul 16, 2024
358d7ab
Add events page and fix up users
tribble Aug 1, 2024
a78fcfc
Make logo go back to home page
tribble Aug 1, 2024
e4c08eb
Handle no more events
tribble Aug 1, 2024
6b32200
Update sample for 5.0
tribble Aug 2, 2024
25f6754
Simplify type validation
tribble Aug 2, 2024
2f0a918
Update version requirement
tribble Aug 2, 2024
7994681
Update version requirement
tribble Aug 2, 2024
1328d22
Update audit logs app for 5.0
tribble Aug 2, 2024
a93126f
Update magic link app to 5.0
tribble Aug 3, 2024
635152e
Update mfa app for 5.0
tribble Aug 5, 2024
ceb7141
Update sso app for 5.0
tribble Aug 6, 2024
7979026
Remove unused imports
tribble Aug 7, 2024
3d99705
Minor change to admin portal app import
tribble Aug 8, 2024
680846c
Update directory sync flask app for the new client init and kwargs
tribble Aug 12, 2024
2c4ec79
Update for client changes
tribble Aug 12, 2024
1c1f24b
Add debug base url to dsync app
tribble Aug 12, 2024
a648ffe
Update for new client
tribble Aug 12, 2024
2c793de
Update for new client
tribble Aug 12, 2024
fbe32ce
Update for new client
tribble Aug 12, 2024
738f955
Update for new client
tribble Aug 12, 2024
29d6a8b
greater than or equal to 5.0
tribble Aug 12, 2024
ee10c0d
Fix workos version
tribble Aug 12, 2024
143e051
Greater or equal to 5.0
tribble Aug 12, 2024
4bb9401
Update event verification with new param name
tribble Aug 14, 2024
70fb316
Slight tweak to domain creation
tribble Aug 14, 2024
cdd2936
Replace DEBUG global with an env variable to set the base api url
tribble Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update for client changes
tribble committed Aug 12, 2024
commit 2c4ec794a1ba8238ee5b01d668d3ce5d38f5dd64
19 changes: 8 additions & 11 deletions python-flask-admin-portal-example/app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
from email.mime import base
import os
from flask import Flask, redirect, render_template, request, url_for
from flask import Flask, redirect, render_template, request
import workos
from workos import client as workos_client
from flask_lucide import Lucide
import workos.organizations
import workos.portal
import workos.resources
import workos.resources.organizations
import workos.resources.portal
import workos.resources.sso
from workos.types import DomainDataInput


@@ -18,9 +12,12 @@
lucide = Lucide(app)

# WorkOS Setup
workos.api_key = os.getenv("WORKOS_API_KEY")
workos.client_id = os.getenv("WORKOS_CLIENT_ID")
workos.base_api_url = "http://localhost:7000/" if DEBUG else workos.base_api_url
base_api_url = "http://localhost:7000/" if DEBUG else None
Copy link

Choose a reason for hiding this comment

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

This feels kind of odd to me for a public example. I wonder if we should just use the WORKOS_BASE_URL environment variable here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. This is a simple change I can make to all of the sample apps.

workos_client = workos.WorkOSClient(
api_key=os.getenv("WORKOS_API_KEY"),
client_id=os.getenv("WORKOS_CLIENT_ID"),
base_url=base_api_url,
)


@app.route("/")
2 changes: 1 addition & 1 deletion python-flask-admin-portal-example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
certifi==2021.5.30
charset-normalizer==2.0.6
click==8.0.1
Flask==2.0.1
Flask==2.0.3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Different examples used different flask versions. I set them all to the same version.

Copy link

Choose a reason for hiding this comment

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

Any reason we can't bump to the latest Flask version? Also fine with keeping this out of scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only reason I didn't bump up to latest version was to limit the scope of changes as I swept through and updated the sample apps. Basically, time savings for me in case bumping up to latest Flask triggered other code or dependency changes.

idna==3.2
itsdangerous==2.0.1
Jinja2==3.0.1