Skip to content

case insensitive #188

@wannadrunk

Description

@wannadrunk

🚀 Feature Request

case insensitive in key name

🔈 Motivation

got the error when doing nav.get() with the lowercase of the fund name. Could we convert it to the required case? It will make library more robust.

>>> nav.get('scbnk225d')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xxx/git/tmp/temp/venv-tmp/lib/python3.10/site-packages/pythainav/api.py", line 45, in get
    nav = _source.get(fund_name, date)
  File "/home/xxx/git/tmp/temp/venv-tmp/lib/python3.10/site-packages/pythainav/sources.py", line 56, in get
    url.args["fund"] = name2fund[fund]["id"]
KeyError: 'scbnk225d'

>>> nav.get('SCBNK225D')
Nav(value=13.1079, updated=datetime.datetime(2022, 12, 28, 0, 0), tags={'latest'}, fund='SCBNK225D')

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions