Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisStevens committed Nov 14, 2013
1 parent 4ef36bc commit 49e8dd1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Quandl/Quandl.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,12 @@ def _getauthtoken(token):
except IOError:
savedtoken = False
if token:
pickle.dump(token, open('authtoken.p', 'wb'))
print("Token {} activated and saved for later use.".format(token))
try:
pickle.dump(token, open('authtoken.p', 'wb'))
print("Token {} activated and saved for later use.".format(token))
except Exception,e:
print("Error writing token to cache: {}".format(str(e)))

elif not savedtoken and not token:
print("No authentication tokens found: usage will be limited.")
print("See www.quandl.com/api for more information.")
Expand All @@ -319,6 +323,6 @@ def _getauthtoken(token):

# In lieu of urllib's urlencode, as this handles None values by ignoring them.
def _append_query_fields(url, **kwargs):
field_values = ['{}={}'.format(key, val)
field_values = ['{0}={1}'.format(key, val)
for key, val in kwargs.items() if val]
return url + '&'.join(field_values)

0 comments on commit 49e8dd1

Please sign in to comment.