Skip to content

Commit

Permalink
Session env fix from development
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Topper committed Sep 19, 2023
1 parent 0c492c5 commit 2a20cc5
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions clients/py/v3io_frames/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

"""Stream data from/to Nuclio into pandas DataFrame"""

__version__ = '0.8.13'
__version__ = '0.0.0+unstable'

import json
import pandas as pd
Expand Down Expand Up @@ -121,5 +121,25 @@ def session_from_env():
if data is None:
return Session()

obj = json.loads(data)
if data.startswith("{"):
obj = json.loads(data)
else:
obj = {}
pairs = data.split(",")
for pair in pairs:
pair = pair.split("=")
if len(pair) != 2:
continue
obj[pair[0]] = pair[1]

v3io_api = environ.get("V3IO_API")
if v3io_api:
obj["url"] = v3io_api

token = environ.get("V3IO_ACCESS_KEY")
if token:
obj["token"] = token
# If token was provided, we don't need user
obj.pop("user", None)

return Session(**obj)

0 comments on commit 2a20cc5

Please sign in to comment.