Skip to content

Commit

Permalink
Parameter parsing
Browse files Browse the repository at this point in the history
Done correctly now for multisets
  • Loading branch information
ChrisStevens committed Dec 22, 2014
1 parent 1002635 commit 23ae01d
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions Quandl/Quandl.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,7 @@ def get(dataset, **kwargs):
with no interference.
"""
kwargs.setdefault('sort_order', 'asc')
verbose = kwargs.get('verbose', False)
if 'text' in kwargs:
print('Deprecated: "text" is deprecated and will be removed in next release, use "verbose" instead.')
if isinstance(kwargs['text'], (strings, str)):
if kwargs['text'].lower() in ['yes', 'y', 't', 'true', 'on']:
verbose = True
else:
verbose = bool(kwargs['text'])
auth_token = _getauthtoken(kwargs.pop('authtoken', ''), verbose)
trim_start = _parse_dates(kwargs.pop('trim_start', None))
trim_end = _parse_dates(kwargs.pop('trim_end', None))
returns = kwargs.get('returns', 'pandas')



#Check whether dataset is given as a string (for a single dataset) or an array (for a multiset call)


Expand Down Expand Up @@ -104,7 +89,20 @@ def get(dataset, **kwargs):
else:
error = "Your dataset must either be specified as a string (containing a Quandl code) or an array (of Quandl codes)"
raise WrongFormat(error)

#parse parameters
kwargs.setdefault('sort_order', 'asc')
verbose = kwargs.get('verbose', False)
if 'text' in kwargs:
print('Deprecated: "text" is deprecated and will be removed in next release, use "verbose" instead.')
if isinstance(kwargs['text'], (strings, str)):
if kwargs['text'].lower() in ['yes', 'y', 't', 'true', 'on']:
verbose = True
else:
verbose = bool(kwargs['text'])
auth_token = _getauthtoken(kwargs.pop('authtoken', ''), verbose)
trim_start = _parse_dates(kwargs.pop('trim_start', None))
trim_end = _parse_dates(kwargs.pop('trim_end', None))
returns = kwargs.get('returns', 'pandas')
#Append all parameters to API call
url = _append_query_fields(url,
auth_token=auth_token,
Expand Down

0 comments on commit 23ae01d

Please sign in to comment.