Skip to content

Commit bd066ef

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 bd066ef

File tree

4 files changed

+64
-13
lines changed

4 files changed

+64
-13
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
atproto\_oauth
2+
==============
3+
4+
.. automodule:: atproto_oauth
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
Subpackages
10+
-----------
11+
12+
.. toctree::
13+
:maxdepth: 4
14+
15+
atproto_oauth.stores
16+
17+
Submodules
18+
----------
19+
20+
.. toctree::
21+
:maxdepth: 4
22+
23+
atproto_oauth.client
24+
atproto_oauth.dpop
25+
atproto_oauth.exceptions
26+
atproto_oauth.metadata
27+
atproto_oauth.models
28+
atproto_oauth.pkce
29+
atproto_oauth.security
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
atproto\_oauth.stores
2+
=====================
3+
4+
.. automodule:: atproto_oauth.stores
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
Submodules
10+
----------
11+
12+
.. toctree::
13+
:maxdepth: 4
14+
15+
atproto_oauth.stores.base
16+
atproto_oauth.stores.memory

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)