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 python docs #576

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Below is an example of a web API server running `aiohttp
async def handle(request):
"""Handle incoming requests."""
client = request.app['client']
username = int(request.match_info.get('name'))
username = request.match_info.get('name')

# Execute the query on any pool connection
result = await client.query_single_json(
Expand All @@ -122,7 +122,7 @@ Below is an example of a web API server running `aiohttp
database='my_service',
user='my_service')
# Configure service routes
app.router.add_route('GET', '/user/{name:\w+}', handle)
Copy link
Contributor Author

@diksipav diksipav Feb 5, 2025

Choose a reason for hiding this comment

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

python interprets \w as an escape sequence, so I removed this regex part
but ofc, can also use the raw string or escape the backslash \\w+

Choose a reason for hiding this comment

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

Oh, I think your change makes sense and feels idiomatic.

app.router.add_route('GET', '/user/{name}', handle)
return app


Expand Down
Loading