Skip to main content

FIFA member associations codes query and search.

Project description

fifacodes

FIFA member associations codes query and search.

A mapping of FIFA member associations codes to member associations names.

The default data is sourced from Wikipedia.

Installation

pip install fifacodes

Usage

You can query like using dict:

>>> from fifacodes import Members
>>> members = Members()
>>> members.get('ENG')
Member(code='ENG', name='England')
>>> len(members)
211
>>> list(members.items())[0]
('AFG', Member(code='AFG', name='Afghanistan'))

Query by name:

>>> members['England']
Member(code='ENG', name='England')

Search for a member by name or code, the search uses fuzzy string matching to find potential results.

>>> members.search('argtl')
[Member(code='ARG', name='Argentina'), Member(code='ARM', name='Armenia'), Member(code='ARU', name='Aruba')]

Results can be adjusted using parameters:

>>> members.search('Fran', limit=2, score_cutoff=70, case_sensitive=True)
[Member(code='FRA', name='France'), Member(code='IRN', name='Iran')]

Search for a member by name or code and return the first result.

>>> members.search_one('Argent')
Member(code='ARG', name='Argentina')

Data Update

To update default.csv run scrape.py, If there are codes corresponding to other member names, add them to custom.csv.

View source code for detailed usage.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fifacodes-0.1.4.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

fifacodes-0.1.4-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page