Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-python
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Wiki
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-python
Commits
8cac09d2
Commit
8cac09d2
authored
2 months ago
by
teplyakov
Browse files
Options
Downloads
Patches
Plain Diff
feat:
AUTO-4047
Fix include readme params
parent
31c9b8c4
No related branches found
No related tags found
1 merge request
!96
feat: AUTO-4047 Fix include readme params
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+7
-8
7 additions, 8 deletions
README.md
perxis/auth.py
+1
-1
1 addition, 1 deletion
perxis/auth.py
with
8 additions
and
9 deletions
README.md
+
7
−
8
View file @
8cac09d2
...
@@ -60,8 +60,9 @@ def metadata_call_credentials(metadata_plugin, name=None):
...
@@ -60,8 +60,9 @@ def metadata_call_credentials(metadata_plugin, name=None):
"""
"""
```
```
Объект CallCredentials можно передать непосредственно в RPC, например:
Объект
`CallCredentials`
можно передать непосредственно в RPC, например:
```
python
```
>>> call_credentials = grpc.metadata_call_credentials(my_foo_plugin)
>>> call_credentials = grpc.metadata_call_credentials(my_foo_plugin)
>>> stub.FooRpc(request, credentials=call_credentials)
>>> stub.FooRpc(request, credentials=call_credentials)
```
```
...
@@ -69,15 +70,14 @@ def metadata_call_credentials(metadata_plugin, name=None):
...
@@ -69,15 +70,14 @@ def metadata_call_credentials(metadata_plugin, name=None):
### Пример авторизации и аутентификации OAuth2
### Пример авторизации и аутентификации OAuth2
```
python
```
python
import
grpc
import
grpc
from
oauthlib.oauth2
import
Client
from
oauthlib.oauth2
import
Client
from
oauthlib.oauth2.rfc6749.parameters
import
prepare_token_request
from
oauthlib.oauth2.rfc6749.parameters
import
prepare_token_request
from
auth
import
OAuth2Plugin
from
perxis.
auth
import
OAuth2Plugin
from
users.users_pb2
import
GetRequest
from
perxis.
users.users_pb2
import
GetRequest
from
users.users_pb2_grpc
import
UsersStub
from
perxis.
users.users_pb2_grpc
import
UsersStub
# Могут быть использованы как встроенные клиенты, такие как WebApplicationClient, BackendApplicationClient,
# так и допускается реализовать собственный класс с кастомным поведением
class
ExtendedClient
(
Client
):
class
ExtendedClient
(
Client
):
def
__init__
(
self
,
client_id
,
grant_type
,
username
,
password
,
**
kwargs
):
def
__init__
(
self
,
client_id
,
grant_type
,
username
,
password
,
**
kwargs
):
...
@@ -117,4 +117,3 @@ with grpc.insecure_channel('localhost:50051') as channel:
...
@@ -117,4 +117,3 @@ with grpc.insecure_channel('localhost:50051') as channel:
stub
=
UsersStub
(
channel
)
stub
=
UsersStub
(
channel
)
stub
.
Get
(
request
,
credentials
=
call_credentials
)
stub
.
Get
(
request
,
credentials
=
call_credentials
)
```
```
This diff is collapsed.
Click to expand it.
perxis/auth.py
+
1
−
1
View file @
8cac09d2
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
## Пример использования:
## Пример использования:
.. include:: ../README.md
.. include:: ../README.md
:start-line: 22
:start-line: 22
:end-line: 10
8
:end-line: 1
2
0
---
---
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment