Skip to content
Snippets Groups Projects
Commit 8cac09d2 authored by teplyakov's avatar teplyakov
Browse files

feat: AUTO-4047 Fix include readme params

parent 31c9b8c4
No related branches found
No related tags found
1 merge request!96feat: AUTO-4047 Fix include readme params
This commit is part of merge request !96. Comments created here will be created in the context of that merge request.
......@@ -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)
```
......@@ -11,7 +11,7 @@
## Пример использования:
.. include:: ../README.md
:start-line: 22
:end-line: 108
:end-line: 120
---
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment