File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
from pathlib import Path
3
3
import ssl
4
+ import tempfile
4
5
import urllib .request
5
6
6
7
from pyarrow import flight
7
8
8
9
9
10
# Check for gRPC certificates
10
- if not Path ('/ usr', 'share' , 'grpc' , 'roots.pem' ).exists ():
11
+ if not ( Path (Path . cwd (). absolute (). anchor ) / ' usr' / 'share' / 'grpc' / 'roots.pem' ).exists ():
11
12
env_name = 'GRPC_DEFAULT_SSL_ROOTS_FILE_PATH'
12
13
if env_name not in os .environ or not Path (os .environ [env_name ]).exists ():
13
- tls_root_certs = './ roots.pem'
14
+ tls_root_certs = Path ( tempfile . gettempdir ()) / ' roots.pem'
14
15
if not Path (tls_root_certs ).exists ():
15
16
print ('Downloading gRPC certificates' )
16
17
ssl ._create_default_https_context = ssl ._create_unverified_context
17
- urllib .request .urlretrieve ('https://pki.google.com/roots.pem' , tls_root_certs )
18
- os .environ [env_name ] = tls_root_certs
18
+ urllib .request .urlretrieve ('https://pki.google.com/roots.pem' , str ( tls_root_certs ) )
19
+ os .environ [env_name ] = str ( tls_root_certs )
19
20
20
21
client = flight .connect ('grpc+tls://flight.spiceai.io' )
21
22
headers = [client .authenticate_basic_token ('' , 'API_KEY' )]
You can’t perform that action at this time.
0 commit comments