Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-python
Manage
Activity
Members
Plan
Custom issue tracker
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-python
Commits
c0ba152e
Commit
c0ba152e
authored
3 years ago
by
Georgiy Eterevskiy
Browse files
Options
Downloads
Patches
Plain Diff
Update examples: add creds for secure channel
parent
aedfe025
Branches
feature/upgrade2
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
MANIFEST.in
+8
-5
8 additions, 5 deletions
MANIFEST.in
examples/collections_auth_client.py
+10
-1
10 additions, 1 deletion
examples/collections_auth_client.py
examples/credentials/root.crt
+31
-0
31 additions, 0 deletions
examples/credentials/root.crt
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
50 additions
and
7 deletions
MANIFEST.in
+
8
−
5
View file @
c0ba152e
# Include the README
include *.md
# Include the license file
include LICENSE.txt
# Include setup.py
include setup.py
# Include the data files
recursive-include data *
\ No newline at end of file
# Include the proto files
recursive-include proto *.proto
# Include the txt files
include *.txt
# Include the proto files
recursive-include examples *.py
\ No newline at end of file
This diff is collapsed.
Click to expand it.
examples/collections_auth_client.py
+
10
−
1
View file @
c0ba152e
import
logging
import
os
import
grpc
from
oauthlib.oauth2
import
BackendApplicationClient
...
...
@@ -7,6 +8,12 @@ from perxis.auth import OAuth2Plugin
from
perxis.collections
import
collections_pb2
,
collections_pb2_grpc
def
_load_credential_from_file
(
filepath
):
real_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
filepath
)
with
open
(
real_path
,
'
rb
'
)
as
f
:
return
f
.
read
()
def
main
():
client_id
=
'
YGPQSAUPgco4iTQxNejtXDjFVwPmYT3n
'
client_secret
=
'
_d6F-VlQGmcsU25AXIoCU4EU3v56-28P6jwUHkutg_hSPseConphyLs3F-Buuq1h
'
...
...
@@ -21,7 +28,9 @@ def main():
)
call_credentials
=
grpc
.
metadata_call_credentials
(
oauth2_plugin
,
name
=
'
auth
'
)
channel_credentials
=
grpc
.
ssl_channel_credentials
()
channel_credentials
=
grpc
.
ssl_channel_credentials
(
root_certificates
=
_load_credential_from_file
(
'
credentials/root.crt
'
)
)
composite_credentials
=
grpc
.
composite_channel_credentials
(
channel_credentials
,
call_credentials
)
...
...
This diff is collapsed.
Click to expand it.
examples/credentials/root.crt
0 → 100644
+
31
−
0
View file @
c0ba152e
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi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A
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
\ No newline at end of file
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
c0ba152e
...
...
@@ -14,7 +14,7 @@ def load_requirements():
setup
(
name
=
'
perxis
'
,
version
=
'
0.0.
4
'
,
version
=
'
0.0.
5
'
,
description
=
'
Perxis python client
'
,
long_description
=
long_description
,
long_description_content_type
=
'
text/markdown
'
,
...
...
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