Query international country groupings (EU, BRICS, G20, NATO, etc.)
Project description
worldcountrygroups
Query international country groupings (EU, BRICS, G20, NATO, etc.) with 46 built-in group definitions.
Installation
pip install worldcountrygroups # core library only
pip install worldcountrygroups[api] # with FastAPI server
Python API
import worldcountrygroups
# List all group IDs
worldcountrygroups.list_groups() # ['acd', 'acp', ..., 'zangger']
# Get a group with full details
group = worldcountrygroups.get_group("brics")
print(group.name) # "BRICS"
print(group.country_count) # 5
# Get countries in a group
countries = worldcountrygroups.get_countries("eu")
print(len(countries)) # 27
# Search groups by country, domain, or text
worldcountrygroups.search_groups(country="Brazil") # groups containing Brazil
worldcountrygroups.search_groups(domain="Africa") # groups in Africa domain
worldcountrygroups.search_groups(q="european") # text search
API Server
worldcountrygroups serve --port 8000
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /groups |
List all groups (summaries) |
| GET | /groups/{gid} |
Get full group with countries |
| GET | /groups/{gid}/countries |
Get countries in a group |
| GET | /countries/{iso} |
Get group memberships for a country |
| GET | /search?q=&country=&domain= |
Search groups |
License
MIT
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
worldcountrygroups-0.3.0.tar.gz
(39.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file worldcountrygroups-0.3.0.tar.gz.
File metadata
- Download URL: worldcountrygroups-0.3.0.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3791186924ac474f295cf7d74abbb162c49088a63354a94b5013747bda1c18bb
|
|
| MD5 |
96b1a9b90164788cf87c7a8ed334e41e
|
|
| BLAKE2b-256 |
c23e9b77186bcd6543f618741841cb79f1f94bddbd0bcca3464aad87a7de9296
|
File details
Details for the file worldcountrygroups-0.3.0-py3-none-any.whl.
File metadata
- Download URL: worldcountrygroups-0.3.0-py3-none-any.whl
- Upload date:
- Size: 91.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b83e4be6ca31bb06b5d04203b68634d2429c1c7f4fa7dc078ba683f798e55a24
|
|
| MD5 |
b0ffd967b760688d9232e3bd0c0fa36d
|
|
| BLAKE2b-256 |
81d8a9318267e6f9935dc6593f71718c40d59786f36d8570a616e9306d948443
|