From 8cac09d27be9ee160faad00c62d933f2049b63ec Mon Sep 17 00:00:00 2001 From: teplyakov <teolyakov@perx.ru> Date: Wed, 9 Apr 2025 15:21:08 +0300 Subject: [PATCH] feat: AUTO-4047 Fix include readme params --- README.md | 15 +++++++-------- perxis/auth.py | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c31bd84..d51920d 100644 --- a/README.md +++ b/README.md @@ -60,8 +60,9 @@ def metadata_call_credentials(metadata_plugin, name=None): """ ``` -Объект CallCredentials можно передать непосредственно в RPC, например: -```python +Объект `CallCredentials` можно передать непосредственно в RPC, например: + +``` >>> call_credentials = grpc.metadata_call_credentials(my_foo_plugin) >>> stub.FooRpc(request, credentials=call_credentials) ``` @@ -69,15 +70,14 @@ def metadata_call_credentials(metadata_plugin, name=None): ### Пример авторизации и аутентификации OAuth2 ```python + import grpc from oauthlib.oauth2 import Client from oauthlib.oauth2.rfc6749.parameters import prepare_token_request -from auth import OAuth2Plugin -from users.users_pb2 import GetRequest -from users.users_pb2_grpc import UsersStub +from perxis.auth import OAuth2Plugin +from perxis.users.users_pb2 import GetRequest +from perxis.users.users_pb2_grpc import UsersStub -# Могут быть использованы как встроенные клиенты, такие как WebApplicationClient, BackendApplicationClient, -# так и допускается реализовать собственный класс с кастомным поведением class ExtendedClient(Client): def __init__(self, client_id, grant_type, username, password, **kwargs): @@ -117,4 +117,3 @@ with grpc.insecure_channel('localhost:50051') as channel: stub = UsersStub(channel) stub.Get(request, credentials=call_credentials) ``` - diff --git a/perxis/auth.py b/perxis/auth.py index 9d96e00..76318df 100644 --- a/perxis/auth.py +++ b/perxis/auth.py @@ -11,7 +11,7 @@ ## Пример использования: .. include:: ../README.md :start-line: 22 - :end-line: 108 + :end-line: 120 --- """ -- GitLab