Skip to content

Commit

Permalink
Check for Alpaca environment variable when getting Polygon key
Browse files Browse the repository at this point in the history
  • Loading branch information
ttt733 committed Jul 15, 2019
1 parent 88bc106 commit b254c85
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions alpaca_trade_api/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def get_credentials(key_id=None, secret_key=None):


def get_polygon_credentials(alpaca_key=None):
try:
alpaca_key, _ = get_credentials(alpaca_key)
except ValueError:
pass
key_id = os.environ.get('POLYGON_KEY_ID') or alpaca_key
if key_id is None:
raise ValueError('Key ID must be given to access Polygon API')
Expand Down

0 comments on commit b254c85

Please sign in to comment.