Skip to content

Commit b3ca39b

Browse files
committed
hasattr
1 parent 55832f9 commit b3ca39b

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

python/examples/ingestion_with_yaml_config/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
load_dotenv()
2222

23-
apikey = os.getenv("SIFT_API_KEY")
23+
apikey = os.getenv("SIFT_LOCAL_API_KEY")
2424

2525
if apikey is None:
2626
raise Exception("Missing 'SIFT_API_KEY' environment variable.")
@@ -34,7 +34,7 @@
3434
telemetry_config = nostromos_lv_426()
3535

3636
# Create a gRPC transport channel configured specifically for the Sift API
37-
sift_channel_config = SiftChannelConfig(uri=base_uri, apikey=apikey)
37+
sift_channel_config = SiftChannelConfig(uri=base_uri, apikey=apikey, use_ssl=False)
3838

3939
with use_sift_channel(sift_channel_config) as channel:
4040
# Create ingestion service using the telemetry config we loaded in

python/lib/sift_py/yaml/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def try_fast_yaml_load(path: Path) -> Dict[Any, Any]:
2323
If the CSafeLoader is not available, use the pyyaml safe loader.
2424
"""
2525
with open(path, "r") as f:
26-
try:
27-
loader = yaml.CSafeLoader
28-
return cast(Dict[Any, Any], yaml.load(f.read(), Loader=loader))
29-
except AttributeError:
26+
if hasattr(yaml, "CSafeLoader"):
27+
return cast(Dict[Any, Any], yaml.load(f.read(), Loader=yaml.CSafeLoader))
28+
else:
3029
return cast(Dict[Any, Any], yaml.safe_load(f.read()))

0 commit comments

Comments
 (0)