aio_taginfo
Typed async client for the taginfo API.
Modules
The api
package structure is in large parts derived from the endpoint path segments:
aio_taginfo.error
aio_taginfo.api.v4
aio_taginfo.api.v4.key.distribution.nodes
aio_taginfo.api.v4.key.distribution.ways
aio_taginfo.api.v4.key.chronology
aio_taginfo.api.v4.key.combinations
aio_taginfo.api.v4.key.overview
aio_taginfo.api.v4.key.prevalent_values
aio_taginfo.api.v4.key.projects
aio_taginfo.api.v4.key.similar
aio_taginfo.api.v4.key.stats
aio_taginfo.api.v4.key.values
aio_taginfo.api.v4.key.wiki_pages
aio_taginfo.api.v4.keys.all
aio_taginfo.api.v4.keys.similar
aio_taginfo.api.v4.keys.wiki_pages
aio_taginfo.api.v4.keys.without_wiki_page
aio_taginfo.api.v4.languages
aio_taginfo.api.v4.project.icon
aio_taginfo.api.v4.project.tags
aio_taginfo.api.v4.projects.all
aio_taginfo.api.v4.projects.keys
aio_taginfo.api.v4.projects.tags
aio_taginfo.api.v4.relation.projects
aio_taginfo.api.v4.relation.roles
aio_taginfo.api.v4.relation.stats
aio_taginfo.api.v4.relation.wiki_pages
aio_taginfo.api.v4.relations.all
aio_taginfo.api.v4.search.by_key_and_value
aio_taginfo.api.v4.search.by_keyword
aio_taginfo.api.v4.search.by_role
aio_taginfo.api.v4.search.by_value
aio_taginfo.api.v4.site.config.geodistribution
aio_taginfo.api.v4.site.info
aio_taginfo.api.v4.site.sources
aio_taginfo.api.v4.tag.chronology
aio_taginfo.api.v4.tag.distribution.nodes
aio_taginfo.api.v4.tag.distribution.ways
aio_taginfo.api.v4.tag.overview
aio_taginfo.api.v4.tag.projects
aio_taginfo.api.v4.tag.stats
aio_taginfo.api.v4.tag.wiki_pages
aio_taginfo.api.v4.tags.list
aio_taginfo.api.v4.tags.popular
aio_taginfo.api.v4.unicode.characters
aio_taginfo.api.v4.wiki.languages
aio_taginfo.api.v4.wikidata.all
aio_taginfo.api.v4.wikidata.errors
Call functions
All the calls are re-exported here at the top level for convenience:
1""" 2Typed async client for the taginfo API. 3 4## Modules 5The `api` package structure is in large parts derived from the endpoint path segments: 6 7* ``aio_taginfo.error`` 8* ``aio_taginfo.api.v4`` 9* ``aio_taginfo.api.v4.key.distribution.nodes`` 10* ``aio_taginfo.api.v4.key.distribution.ways`` 11* ``aio_taginfo.api.v4.key.chronology`` 12* ``aio_taginfo.api.v4.key.combinations`` 13* ``aio_taginfo.api.v4.key.overview`` 14* ``aio_taginfo.api.v4.key.prevalent_values`` 15* ``aio_taginfo.api.v4.key.projects`` 16* ``aio_taginfo.api.v4.key.similar`` 17* ``aio_taginfo.api.v4.key.stats`` 18* ``aio_taginfo.api.v4.key.values`` 19* ``aio_taginfo.api.v4.key.wiki_pages`` 20* ``aio_taginfo.api.v4.keys.all`` 21* ``aio_taginfo.api.v4.keys.similar`` 22* ``aio_taginfo.api.v4.keys.wiki_pages`` 23* ``aio_taginfo.api.v4.keys.without_wiki_page`` 24* ``aio_taginfo.api.v4.languages`` 25* ``aio_taginfo.api.v4.project.icon`` 26* ``aio_taginfo.api.v4.project.tags`` 27* ``aio_taginfo.api.v4.projects.all`` 28* ``aio_taginfo.api.v4.projects.keys`` 29* ``aio_taginfo.api.v4.projects.tags`` 30* ``aio_taginfo.api.v4.relation.projects`` 31* ``aio_taginfo.api.v4.relation.roles`` 32* ``aio_taginfo.api.v4.relation.stats`` 33* ``aio_taginfo.api.v4.relation.wiki_pages`` 34* ``aio_taginfo.api.v4.relations.all`` 35* ``aio_taginfo.api.v4.search.by_key_and_value`` 36* ``aio_taginfo.api.v4.search.by_keyword`` 37* ``aio_taginfo.api.v4.search.by_role`` 38* ``aio_taginfo.api.v4.search.by_value`` 39* ``aio_taginfo.api.v4.site.config.geodistribution`` 40* ``aio_taginfo.api.v4.site.info`` 41* ``aio_taginfo.api.v4.site.sources`` 42* ``aio_taginfo.api.v4.tag.chronology`` 43* ``aio_taginfo.api.v4.tag.distribution.nodes`` 44* ``aio_taginfo.api.v4.tag.distribution.ways`` 45* ``aio_taginfo.api.v4.tag.overview`` 46* ``aio_taginfo.api.v4.tag.projects`` 47* ``aio_taginfo.api.v4.tag.stats`` 48* ``aio_taginfo.api.v4.tag.wiki_pages`` 49* ``aio_taginfo.api.v4.tags.list`` 50* ``aio_taginfo.api.v4.tags.popular`` 51* ``aio_taginfo.api.v4.unicode.characters`` 52* ``aio_taginfo.api.v4.wiki.languages`` 53* ``aio_taginfo.api.v4.wikidata.all`` 54* ``aio_taginfo.api.v4.wikidata.errors`` 55 56## Call functions 57All the calls are re-exported here at the top level for convenience: 58""" 59 60import importlib.metadata 61 62 63__version__: str = importlib.metadata.version("aio-taginfo") 64 65# we add this to all modules for pdoc; 66# see https://pdoc.dev/docs/pdoc.html#use-numpydoc-or-google-docstrings 67__docformat__ = "google" 68 69# we also use __all__ in all modules for pdoc; this lets us control the order 70__all__ = ( 71 "__version__", 72 "TaginfoError", 73 "api", # pyright: ignore[reportUnsupportedDunderAll] 74 "error", # pyright: ignore[reportUnsupportedDunderAll] 75 "key_chronology", 76 "key_combinations", 77 "key_distribution_nodes", 78 "key_distribution_ways", 79 "key_overview", 80 "key_prevalent_values", 81 "key_projects", 82 "key_similar", 83 "key_stats", 84 "relation_projects", 85 "site_config_geodistribution", 86 "tag_projects", 87 "tags_popular", 88) 89 90from aio_taginfo.api.v4.key.chronology import call as key_chronology 91from aio_taginfo.api.v4.key.combinations import call as key_combinations 92from aio_taginfo.api.v4.key.distribution.nodes import call as key_distribution_nodes 93from aio_taginfo.api.v4.key.distribution.ways import call as key_distribution_ways 94from aio_taginfo.api.v4.key.overview import call as key_overview 95from aio_taginfo.api.v4.key.prevalent_values import call as key_prevalent_values 96from aio_taginfo.api.v4.key.projects import call as key_projects 97from aio_taginfo.api.v4.key.similar import call as key_similar 98from aio_taginfo.api.v4.key.stats import call as key_stats 99from aio_taginfo.api.v4.relation.projects import call as relation_projects 100from aio_taginfo.api.v4.site.config.geodistribution import call as site_config_geodistribution 101from aio_taginfo.api.v4.tag.projects import call as tag_projects 102from aio_taginfo.api.v4.tags.popular import call as tags_popular 103from aio_taginfo.error import TaginfoError
Base class for taginfo API errors.
Inherited Members
- builtins.Exception
- Exception
- builtins.BaseException
- with_traceback
- args
43async def call( 44 key: str, 45 session: ClientSession | None = None, 46) -> Response[list[KeyChronology]]: 47 """ 48 Get chronology of key counts. 49 50 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_chronology 51 52 Args: 53 key: tag key 54 session: request client session 55 56 Raises: 57 TaginfoError 58 """ 59 return await api_get_json( 60 path="key/chronology", 61 cls=Response[list[KeyChronology]], 62 session=session, 63 params=api_params(_Params, key=key), 64 )
Get chronology of key counts.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_chronology
Arguments:
- key: tag key
- session: request client session
Raises:
- TaginfoError
58async def call( 59 key: str, 60 query: str | None = None, 61 sortname: KeyCombinationSorting = KeyCombinationSorting.TOGETHER_COUNT, 62 sortorder: SortOrder = SortOrder.DESC, 63 filter: ObjectType = ObjectType.ALL, # noqa: A002 64 page: int = 1, 65 rp: int = 0, 66 session: ClientSession | None = None, 67) -> Response[list[KeyCombination]]: 68 """ 69 Find keys that are used together with a given key. 70 71 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_combinations 72 73 Args: 74 key: tag key 75 query: only show results where the ``other_key`` matches this query (substring match) 76 sortname: what field to sort by 77 sortorder: sort order 78 filter: can be used to filter only values on tags used on nodes/ways/relations 79 page: page number (starting at 1) 80 rp: results per page 81 session: request client session 82 83 Raises: 84 TaginfoError 85 """ 86 params = api_params( 87 _Params, 88 key=key, 89 query=query, 90 sortname=sortname, 91 sortorder=sortorder, 92 filter=filter, 93 page=page, 94 rp=rp, 95 ) 96 return await api_get_json( 97 path="key/combinations", 98 cls=Response[list[KeyCombination]], 99 session=session, 100 params=params, 101 )
Find keys that are used together with a given key.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_combinations
Arguments:
- key: tag key
- query: only show results where the
other_key
matches this query (substring match) - sortname: what field to sort by
- sortorder: sort order
- filter: can be used to filter only values on tags used on nodes/ways/relations
- page: page number (starting at 1)
- rp: results per page
- session: request client session
Raises:
- TaginfoError
20async def call(key: str, session: ClientSession | None = None) -> PngResponse: 21 """ 22 Get map with distribution of this key in the database (nodes only). 23 24 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_distribution_nodes 25 26 Args: 27 key: tag key 28 session: request client session 29 30 Raises: 31 TaginfoError 32 """ 33 params = api_params(_Params, key=key) 34 return await api_get_png( 35 path="/api/4/key/distribution/nodes", 36 session=session, 37 params=params, 38 )
Get map with distribution of this key in the database (nodes only).
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_distribution_nodes
Arguments:
- key: tag key
- session: request client session
Raises:
- TaginfoError
20async def call(key: str, session: ClientSession | None = None) -> PngResponse: 21 """ 22 Get map with distribution of this key in the database (ways only). 23 24 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_distribution_ways 25 26 Args: 27 key: tag key 28 session: request client session 29 30 Raises: 31 TaginfoError 32 """ 33 params = api_params(_Params, key=key) 34 return await api_get_png( 35 path="/api/4/key/distribution/ways", 36 session=session, 37 params=params, 38 )
Get map with distribution of this key in the database (ways only).
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_distribution_ways
Arguments:
- key: tag key
- session: request client session
Raises:
- TaginfoError
28async def call( 29 key: str, 30 session: ClientSession | None = None, 31) -> Response["KeyOverview"]: 32 """ 33 Show various data for given key. 34 35 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_overview 36 37 Args: 38 key: tag key 39 session: request client session 40 41 Raises: 42 TaginfoError 43 """ 44 return await api_get_json( 45 path="key/overview", 46 cls=Response[KeyOverview], 47 session=session, 48 params=api_params(_Params, key=key), 49 )
Show various data for given key.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_overview
Arguments:
- key: tag key
- session: request client session
Raises:
- TaginfoError
41async def call( 42 key: str, 43 min_fraction: float = 0.01, 44 filter: ObjectType = ObjectType.ALL, # noqa: A002 45 session: ClientSession | None = None, 46) -> Response[list[PrevalentValue]]: 47 """ 48 Get most prevalent values used with a given key. 49 50 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_prevalent_values 51 52 Args: 53 key: tag key 54 min_fraction: only return values which are used in at least this percent 55 of all objects with this key (defaults to 0.01) 56 filter: can be used to filter only values on tags used on nodes/ways/relations 57 session: request client session 58 59 Raises: 60 TaginfoError 61 """ 62 params = api_params(_Params, key=key, min_fraction=min_fraction, filter=filter) 63 return await api_get_json( 64 path="key/prevalent_values", 65 cls=Response[list[PrevalentValue]], 66 session=session, 67 params=params, 68 )
Get most prevalent values used with a given key.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_prevalent_values
Arguments:
- key: tag key
- min_fraction: only return values which are used in at least this percent of all objects with this key (defaults to 0.01)
- filter: can be used to filter only values on tags used on nodes/ways/relations
- session: request client session
Raises:
- TaginfoError
79async def call( 80 key: str, 81 query: str | None = None, 82 sortname: KeyProjectSorting = KeyProjectSorting.PROJECT_NAME, 83 sortorder: SortOrder = SortOrder.ASC, 84 filter: ObjectType = ObjectType.ALL, # noqa: A002 85 page: int = 1, 86 rp: int = 0, 87 session: ClientSession | None = None, 88) -> Response[list[KeyProject]]: 89 """ 90 Get projects using a given key. 91 92 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_projects 93 94 Args: 95 key: tag key 96 query: only show results where the project name or tag value matches this query 97 (substring match) 98 sortname: what field to sort by 99 sortorder: sort order 100 filter: can be used to filter only values on tags used on nodes/ways/relations 101 page: page number (starting at 1) 102 rp: results per page 103 session: request client session 104 105 Raises: 106 TaginfoError 107 """ 108 params = api_params( 109 _Params, 110 key=key, 111 query=query, 112 sortname=sortname, 113 sortorder=sortorder, 114 filter=filter, 115 page=page, 116 rp=rp, 117 ) 118 return await api_get_json( 119 path="key/projects", 120 cls=Response[list[KeyProject]], 121 session=session, 122 params=params, 123 )
Get projects using a given key.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_projects
Arguments:
- key: tag key
- query: only show results where the project name or tag value matches this query (substring match)
- sortname: what field to sort by
- sortorder: sort order
- filter: can be used to filter only values on tags used on nodes/ways/relations
- page: page number (starting at 1)
- rp: results per page
- session: request client session
Raises:
- TaginfoError
55async def call( 56 key: str, 57 query: str | None = None, 58 sortname: SimilarKeySorting = SimilarKeySorting.OTHER_KEY, 59 sortorder: SortOrder = SortOrder.ASC, 60 page: int = 1, 61 rp: int = 0, 62 session: ClientSession | None = None, 63) -> Response[list[SimilarKey]]: 64 """ 65 Find keys that are similar to a given key. 66 67 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_similar 68 69 Args: 70 key: tag key 71 query: only show results where the ``other_key`` matches this query (substring match) 72 sortname: what field to sort by 73 sortorder: sort order 74 page: page number (starting at 1) 75 rp: results per page 76 session: request client session 77 78 Raises: 79 TaginfoError 80 """ 81 params = api_params( 82 _Params, key=key, query=query, sortname=sortname, sortorder=sortorder, page=page, rp=rp 83 ) 84 return await api_get_json( 85 path="key/similar", 86 cls=Response[list[SimilarKey]], 87 session=session, 88 params=params, 89 )
Find keys that are similar to a given key.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_similar
Arguments:
- key: tag key
- query: only show results where the
other_key
matches this query (substring match) - sortname: what field to sort by
- sortorder: sort order
- page: page number (starting at 1)
- rp: results per page
- session: request client session
Raises:
- TaginfoError
41async def call( 42 key: str, 43 session: ClientSession | None = None, 44) -> Response[list[KeyStats]]: 45 """ 46 Show some database statistics for given key. 47 48 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_stats 49 50 Args: 51 key: tag key 52 session: request client session 53 54 Raises: 55 TaginfoError 56 """ 57 return await api_get_json( 58 path="key/stats", 59 cls=Response[list[KeyStats]], 60 session=session, 61 params=api_params(_Params, key=key), 62 )
Show some database statistics for given key.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_stats
Arguments:
- key: tag key
- session: request client session
Raises:
- TaginfoError
67async def call( 68 rtype: str, 69 query: str | None = None, 70 sortname: RelationProjectSorting = RelationProjectSorting.PROJECT_NAME, 71 sortorder: SortOrder = SortOrder.ASC, 72 page: int = 1, 73 rp: int = 0, 74 session: ClientSession | None = None, 75) -> Response[list[RelationProject]]: 76 """ 77 Get projects using a given relation type. 78 79 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_relation_projects 80 81 Args: 82 rtype: Relation type 83 query: Only show results where the value matches this query (substring match) 84 sortname: what field to sort by 85 sortorder: sort order 86 page: page number (starting at 1) 87 rp: results per page 88 session: request client session 89 90 Raises: 91 TaginfoError 92 """ 93 params = api_params( 94 _Params, 95 rtype=rtype, 96 query=query, 97 sortname=sortname, 98 sortorder=sortorder, 99 page=page, 100 rp=rp, 101 ) 102 return await api_get_json( 103 path="relation/projects", 104 cls=Response[list[RelationProject]], 105 session=session, 106 params=params, 107 )
Get projects using a given relation type.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_relation_projects
Arguments:
- rtype: Relation type
- query: Only show results where the value matches this query (substring match)
- sortname: what field to sort by
- sortorder: sort order
- page: page number (starting at 1)
- rp: results per page
- session: request client session
Raises:
- TaginfoError
17async def call(session: ClientSession | None = None) -> "SiteConfigGeodistribution": 18 """ 19 Get information about the background map for distribution charts. 20 21 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_site_config_geodistribution 22 23 Args: 24 session: request client session 25 26 Raises: 27 TaginfoError 28 """ 29 return await api_get_json( 30 path="/api/4/site/config/geodistribution", 31 cls=SiteConfigGeodistribution, 32 session=session, 33 )
Get information about the background map for distribution charts.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_site_config_geodistribution
Arguments:
- session: request client session
Raises:
- TaginfoError
80async def call( 81 key: str, 82 value: str, 83 query: str | None = None, 84 sortname: TagProjectSorting = TagProjectSorting.PROJECT_NAME, 85 sortorder: SortOrder = SortOrder.ASC, 86 filter: ObjectType = ObjectType.ALL, # noqa: A002 87 page: int = 1, 88 rp: int = 0, 89 session: ClientSession | None = None, 90) -> Response[list[TagProject]]: 91 """ 92 Get projects using a given tag. 93 94 https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_tag_projects 95 96 Args: 97 key: tag key 98 value: tag value 99 query: Only show results where the project name matches this query (substring match) 100 sortname: what field to sort by 101 sortorder: sort order 102 filter: can be used to filter only values on tags used on nodes/ways/relations 103 page: page number (starting at 1) 104 rp: results per page 105 session: request client session 106 107 Raises: 108 TaginfoError 109 """ 110 params = api_params( 111 _Params, 112 key=key, 113 value=value, 114 query=query, 115 sortname=sortname, 116 sortorder=sortorder, 117 filter=filter, 118 page=page, 119 rp=rp, 120 ) 121 return await api_get_json( 122 path="tag/projects", 123 cls=Response[list[TagProject]], 124 session=session, 125 params=params, 126 )
Get projects using a given tag.
https://taginfo.openstreetmap.org/taginfo/apidoc#api_4_tag_projects
Arguments:
- key: tag key
- value: tag value
- query: Only show results where the project name matches this query (substring match)
- sortname: what field to sort by
- sortorder: sort order
- filter: can be used to filter only values on tags used on nodes/ways/relations
- page: page number (starting at 1)
- rp: results per page
- session: request client session
Raises:
- TaginfoError