forked from googleapis/google-auth-library-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.py
More file actions
38 lines (28 loc) · 869 Bytes
/
Copy pathsample.py
File metadata and controls
38 lines (28 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import faulthandler
import os
faulthandler.enable()
from google.auth.transport.requests import AuthorizedSession
from google.auth import credentials
creds = credentials.AnonymousCredentials()
cert_file = os.path.join(os.getcwd(), "cert.pem")
import certifi
def where():
return cert_file
certifi.where = where
def run_sample(callback):
authed_session = AuthorizedSession(creds)
authed_session.configure_mtls_channel(callback)
response = authed_session.request('GET', "https://localhost:3000/foo")
print(response.status_code)
print(response.text)
def callback_windows():
key = {
"type": "windows_cert_store",
"key_info": {
"provider": "local_machine",
"store_name": "MY",
"issuer": "localhost"
}
}
return None, key
for i in range(12): run_sample(callback_windows)