# countries-meta
A Python module to access general countries information including name, origin name, dial code, currency, capital, timezone, and current time.
## Installation
```bash
pip install countries-meta
```
## Usage
```python
from countries_meta import Countries
countries = Countries()
# Get country by code
us = countries.get_by_code('US')
us = countries.get('US')
us = countries['US']
print(us.name) # United States
# Get country by name
germany = countries.get_by_name('Germany')
print(germany.capital) # Berlin
# Get country by origin name
fr = countries.get_by_origin_name('République française')
print(fr.dial_code) # +33
# Get country by dial code
canada = countries.get_by_dial_code('+1')
print(canada.name) # Canada
# Filter countries by currency code
usd_countries = countries.filter_by_currency_code('USD')
print([c.name for c in usd_countries])
# Filter countries by region
european_countries = countries.filter_by_region('Europe')
print([c.name for c in european_countries])
# Access timezone info and current time
print(us.timezone) # America/Washington
print(us.now) # Current local time
print(us.time_offset) # Offset in hours from UTC
# Convert to dict or JSON
print(us.to_dict())
print(us.to_json())
```
## Classes
### `Country`
* Attributes: `code`, `name`, `origin_name`, `dial_code`, `currency_code`, `currency_symbol`, `capital`, `timezone`
* Properties:
* `tzinfo`: `ZoneInfo` object for the timezone
* `now`: current datetime in the country's timezone
* `time_offset`: UTC offset in hours
* Methods:
* `to_dict(*keys)`: return dict representation
* `to_json(*keys)`: return JSON string
### `Countries`
* Iterable container of all countries
* Methods to access countries:
* `get_by_code(code)`
* `get_by_name(name)`
* `get_by_origin_name(name)`
* `get_by_dial_code(dial_code)`
* `get_by_currency_code(currency_code)`
* `filter_by_currency_code(currency_code)`
* `filter_by_region(region)`
## License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "countries-meta",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "python, countries, country-info, dial-code, currency, capital, timezone, geography, international",
"author": null,
"author_email": "EightShift <the8shift@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/02/84/aa98585d1551fd57f38a79463e14498e4af6fc260a5f59bd49930460e02d/countries_meta-0.1.1.tar.gz",
"platform": null,
"description": "# countries-meta\r\n\r\nA Python module to access general countries information including name, origin name, dial code, currency, capital, timezone, and current time.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install countries-meta\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom countries_meta import Countries\r\n\r\ncountries = Countries()\r\n\r\n# Get country by code\r\nus = countries.get_by_code('US')\r\nus = countries.get('US')\r\nus = countries['US']\r\nprint(us.name) # United States\r\n\r\n# Get country by name\r\ngermany = countries.get_by_name('Germany')\r\nprint(germany.capital) # Berlin\r\n\r\n# Get country by origin name\r\nfr = countries.get_by_origin_name('R\u00e9publique fran\u00e7aise')\r\nprint(fr.dial_code) # +33\r\n\r\n# Get country by dial code\r\ncanada = countries.get_by_dial_code('+1')\r\nprint(canada.name) # Canada\r\n\r\n# Filter countries by currency code\r\nusd_countries = countries.filter_by_currency_code('USD')\r\nprint([c.name for c in usd_countries])\r\n\r\n# Filter countries by region\r\neuropean_countries = countries.filter_by_region('Europe')\r\nprint([c.name for c in european_countries])\r\n\r\n# Access timezone info and current time\r\nprint(us.timezone) # America/Washington\r\nprint(us.now) # Current local time\r\nprint(us.time_offset) # Offset in hours from UTC\r\n\r\n# Convert to dict or JSON\r\nprint(us.to_dict())\r\nprint(us.to_json())\r\n```\r\n\r\n## Classes\r\n\r\n### `Country`\r\n\r\n* Attributes: `code`, `name`, `origin_name`, `dial_code`, `currency_code`, `currency_symbol`, `capital`, `timezone`\r\n* Properties:\r\n\r\n * `tzinfo`: `ZoneInfo` object for the timezone\r\n * `now`: current datetime in the country's timezone\r\n * `time_offset`: UTC offset in hours\r\n* Methods:\r\n\r\n * `to_dict(*keys)`: return dict representation\r\n * `to_json(*keys)`: return JSON string\r\n\r\n### `Countries`\r\n\r\n* Iterable container of all countries\r\n* Methods to access countries:\r\n\r\n * `get_by_code(code)`\r\n * `get_by_name(name)`\r\n * `get_by_origin_name(name)`\r\n * `get_by_dial_code(dial_code)`\r\n * `get_by_currency_code(currency_code)`\r\n * `filter_by_currency_code(currency_code)`\r\n * `filter_by_region(region)`\r\n\r\n## License\r\n\r\nMIT\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python module to access general countries information including name, origin name, dial code, currency, capital, timezone, and current time.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/EightShift/countries-meta"
},
"split_keywords": [
"python",
" countries",
" country-info",
" dial-code",
" currency",
" capital",
" timezone",
" geography",
" international"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b909e87f80624cddd6b2b8dab9edc416762bd3891541b49f7e619ba1ab7746e1",
"md5": "a75285bb22ac85999aeab59da134ebea",
"sha256": "c97300bbe94048a7f0f91999c350b625e59e8000aeacd635eabf9c6b2992af87"
},
"downloads": -1,
"filename": "countries_meta-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a75285bb22ac85999aeab59da134ebea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 10186,
"upload_time": "2025-10-06T08:17:41",
"upload_time_iso_8601": "2025-10-06T08:17:41.912017Z",
"url": "https://files.pythonhosted.org/packages/b9/09/e87f80624cddd6b2b8dab9edc416762bd3891541b49f7e619ba1ab7746e1/countries_meta-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0284aa98585d1551fd57f38a79463e14498e4af6fc260a5f59bd49930460e02d",
"md5": "c989eb6a5fc1335043fd2a8e5db14e6f",
"sha256": "338b22975085cce75821c3eff1e46ef7b2817c46c1388be1ad6f8028ad098c36"
},
"downloads": -1,
"filename": "countries_meta-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "c989eb6a5fc1335043fd2a8e5db14e6f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9934,
"upload_time": "2025-10-06T08:17:43",
"upload_time_iso_8601": "2025-10-06T08:17:43.104129Z",
"url": "https://files.pythonhosted.org/packages/02/84/aa98585d1551fd57f38a79463e14498e4af6fc260a5f59bd49930460e02d/countries_meta-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-06 08:17:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "EightShift",
"github_project": "countries-meta",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "countries-meta"
}