Skip to content

Commit c7ab563

Browse files
zzstoatzzclaude
andcommitted
fix CI: run ruff format and generate sphinx docs
- run ruff format on Flask demo app - generate sphinx documentation for atproto_oauth package - add atproto_oauth to docs module index resolves codegen_check and ruff CI failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 986c196 commit c7ab563

File tree

4 files changed

+125
-13
lines changed

4 files changed

+125
-13
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
atproto\_oauth package
2+
======================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
atproto_oauth.stores
11+
12+
Submodules
13+
----------
14+
15+
atproto\_oauth.client module
16+
----------------------------
17+
18+
.. automodule:: atproto_oauth.client
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
atproto\_oauth.dpop module
24+
--------------------------
25+
26+
.. automodule:: atproto_oauth.dpop
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
atproto\_oauth.exceptions module
32+
--------------------------------
33+
34+
.. automodule:: atproto_oauth.exceptions
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
atproto\_oauth.metadata module
40+
------------------------------
41+
42+
.. automodule:: atproto_oauth.metadata
43+
:members:
44+
:undoc-members:
45+
:show-inheritance:
46+
47+
atproto\_oauth.models module
48+
----------------------------
49+
50+
.. automodule:: atproto_oauth.models
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
atproto\_oauth.pkce module
56+
--------------------------
57+
58+
.. automodule:: atproto_oauth.pkce
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
atproto\_oauth.security module
64+
------------------------------
65+
66+
.. automodule:: atproto_oauth.security
67+
:members:
68+
:undoc-members:
69+
:show-inheritance:
70+
71+
Module contents
72+
---------------
73+
74+
.. automodule:: atproto_oauth
75+
:members:
76+
:undoc-members:
77+
:show-inheritance:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
atproto\_oauth.stores package
2+
=============================
3+
4+
Submodules
5+
----------
6+
7+
atproto\_oauth.stores.base module
8+
---------------------------------
9+
10+
.. automodule:: atproto_oauth.stores.base
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
atproto\_oauth.stores.memory module
16+
-----------------------------------
17+
18+
.. automodule:: atproto_oauth.stores.memory
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
Module contents
24+
---------------
25+
26+
.. automodule:: atproto_oauth.stores
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:

docs/source/atproto/modules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ packages
1313
atproto_firehose
1414
atproto_identity
1515
atproto_lexicon
16+
atproto_oauth
1617
atproto_server

examples/oauth_flask_demo/app.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
SCOPE = 'atproto'
2424

2525
# Create client_id for localhost testing
26-
CLIENT_ID = 'http://localhost?' + urlencode({
27-
'redirect_uri': REDIRECT_URI,
28-
'scope': SCOPE,
29-
})
26+
CLIENT_ID = 'http://localhost?' + urlencode(
27+
{
28+
'redirect_uri': REDIRECT_URI,
29+
'scope': SCOPE,
30+
}
31+
)
3032

3133
# Initialize OAuth client with memory stores (for demo only!)
3234
oauth_client = OAuthClient(
@@ -77,6 +79,7 @@ def login() -> str:
7779
try:
7880
# Start OAuth authorization
7981
import asyncio
82+
8083
auth_url, state = asyncio.run(oauth_client.start_authorization(handle))
8184

8285
# Store state in session for verification
@@ -87,11 +90,9 @@ def login() -> str:
8790

8891
except Exception: # noqa: BLE001
8992
import traceback
93+
9094
error_msg = traceback.format_exc()
91-
return (
92-
f'<html><body><h1>Login Error</h1><pre>{error_msg}</pre>'
93-
f'<p><a href="/">Back</a></p></body></html>'
94-
), 500
95+
return (f'<html><body><h1>Login Error</h1><pre>{error_msg}</pre><p><a href="/">Back</a></p></body></html>'), 500
9596

9697

9798
@app.route('/callback')
@@ -121,6 +122,7 @@ def callback() -> str:
121122
try:
122123
# Complete OAuth flow
123124
import asyncio
125+
124126
oauth_session = asyncio.run(oauth_client.handle_callback(code, state, iss))
125127

126128
# Store user info in session
@@ -143,6 +145,7 @@ def logout() -> str:
143145
try:
144146
# Revoke OAuth session
145147
import asyncio
148+
146149
oauth_session = asyncio.run(oauth_client.session_store.get_session(user_did))
147150
if oauth_session:
148151
asyncio.run(oauth_client.revoke_session(oauth_session))
@@ -170,11 +173,13 @@ def api_profile() -> tuple:
170173
return jsonify({'error': 'Session not found'}), 401
171174

172175
# Make authenticated request to PDS
173-
response = asyncio.run(oauth_client.make_authenticated_request(
174-
session=oauth_session,
175-
method='GET',
176-
url=f'{oauth_session.pds_url}/xrpc/com.atproto.repo.describeRepo?repo={user_did}',
177-
))
176+
response = asyncio.run(
177+
oauth_client.make_authenticated_request(
178+
session=oauth_session,
179+
method='GET',
180+
url=f'{oauth_session.pds_url}/xrpc/com.atproto.repo.describeRepo?repo={user_did}',
181+
)
182+
)
178183

179184
if response.status_code != 200:
180185
return jsonify({'error': 'PDS request failed', 'status': response.status_code}), 500

0 commit comments

Comments
 (0)