{"id":25880914,"url":"https://github.com/porimol/countryinfo","last_synced_at":"2025-05-15T11:03:33.742Z","repository":{"id":42520271,"uuid":"131966559","full_name":"porimol/countryinfo","owner":"porimol","description":"A python module for returning data about countries, ISO info and states/provinces within them.","archived":false,"fork":false,"pushed_at":"2024-10-28T21:22:41.000Z","size":1338,"stargazers_count":153,"open_issues_count":30,"forks_count":48,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-12T17:40:17.740Z","etag":null,"topics":["country","country-information","country-list","country-names","python","python-country","python-country-list","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/porimol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"porimol"}},"created_at":"2018-05-03T08:41:26.000Z","updated_at":"2025-04-05T23:11:40.000Z","dependencies_parsed_at":"2023-11-22T21:24:38.041Z","dependency_job_id":"87a667d2-a0c9-48ba-b051-ef869dec4198","html_url":"https://github.com/porimol/countryinfo","commit_stats":{"total_commits":28,"total_committers":12,"mean_commits":"2.3333333333333335","dds":0.7857142857142857,"last_synced_commit":"7c6b1acc0d18335ff8f6103a8d8b45b9e9c4bfb5"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porimol%2Fcountryinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porimol%2Fcountryinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porimol%2Fcountryinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porimol%2Fcountryinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/porimol","download_url":"https://codeload.github.com/porimol/countryinfo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248910846,"owners_count":21181984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["country","country-information","country-list","country-names","python","python-country","python-country-list","python3"],"created_at":"2025-03-02T14:26:26.547Z","updated_at":"2025-04-14T15:52:14.901Z","avatar_url":"https://github.com/porimol.png","language":"Python","funding_links":["https://github.com/sponsors/porimol"],"categories":[],"sub_categories":[],"readme":"# Country Info\nA python module for returning data about countries, ISO info and states/provinces within them.\n\n## Table of Contents\n\n* [Install](#install)\n* [API Usage](#api-usage)\n\n## APIs\n* [.info()](#info)\n* [.provinces()](#provinces)\n* [.alt_spellings()](#alt_spellings)\n* [.area()](#area)\n* [.borders()](#borders)\n* [.calling_codes()](#calling_codes)\n* [.capital()](#capital)\n* [.capital_latlng()](#capital_latlng)\n* [.currencies()](#currencies)\n* [.demonym()](#demonym)\n* [.geojson()`](#geo_json)\n* [.iso()](#iso)\n* [.languages()](#languages)\n* [.latlng()](#latlng)\n* [.native_name()](#native_name)\n* [.population()](#population)\n* [.region()](#region)\n* [.subregion()](#subregion)\n* [.timezones()](#timezones)\n* [.tld()](#tld)\n* [.translations()](#translations)\n* [.wiki()](#wiki)\n* [.google()](#google)\n* [.all()](#all)\n\n\n## Acknowledgement\n* [Special Thanks](#special-thanks)\n* [Contributing](#contributing)\n* [Changelog](#changelog)\n* [Disclaimer](#disclaimer)\n* [License (MIT)](#license)\n\n## Install\n\n```python\npip install countryinfo\n```\n\nOR, git clone\n\n```python\ngit clone https://github.com/porimol/countryinfo.git\n\ncd countryinfo\npython setup.py install\n```\n\n## API Usage\nTo access one of the country properties available, you'll need to use one of the API methods listed below and pass a country in either way.\n\n### .info()\n\nReturns all available information for a specified country.\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.info()\n# returns object,\n{\n    'ISO': {\n        'alpha2': 'SG',\n        'alpha3': 'SGP'\n    },\n    'altSpellings': [\n        'SG',\n        'Singapura',\n        'Republik Singapura',\n        '新加坡共和国'\n    ],\n    'area': 710,\n    'borders': [],\n    'callingCodes': ['65'],\n    'capital': 'Singapore',\n    'capital_latlng': [\n        1.357107,\n        103.819499\n    ],\n    'currencies': ['SGD'],\n    'demonym': 'Singaporean',\n    'flag': '',\n    'geoJSON': {},\n    'languages': [\n        'en',\n        'ms',\n        'ta',\n        'zh'\n    ],\n    'latlng': [\n        1.36666666,\n        103.8\n    ],\n    'name': 'Singapore',\n    'nativeName': 'Singapore',\n    'population': 5469700,\n    'provinces': ['Singapore'],\n    'region': 'Asia',\n    'subregion': 'South-Eastern Asia',\n    'timezones': ['UTC+08:00'],\n    'tld': ['.sg'],\n    'translations': {\n        'de': 'Singapur',\n        'es': 'Singapur',\n        'fr': 'Singapour',\n        'it': 'Singapore',\n        'ja': 'シンガポール'\n    },\n    'wiki': 'http://en.wikipedia.org/wiki/singapore',\n    'google': 'https://www.google.com/search?q=Singapore'\n}\n\n# Similar can also be achieved via country code or any\n# alternate name of a country. For example, Singapur\n# would be:\ncountry = CountryInfo('SG')\n```\n\n### .provinces()\nReturn provinces list\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.provinces()\n# returns object,\n['Singapore']\n```\n\n### .alt_spellings()\n\nReturns alternate spellings for the name of a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.alt_spellings()\n# returns list of strings, alternate names\n# ['SG', 'Singapura', 'Republik Singapura', '新加坡共和国']\n```\n\n### .area()\n\nReturns area (km²) for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.area()\n# returns number of square kilometer area\n710\n```\n\n### .borders()\n\nReturns bordering countries (ISO3) for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.borders()\n# returns array of strings, ISO3 codes of countries that border the given country\n[]\n```\n\n### .calling_codes()\n\nReturns international calling codes for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.calling_codes()\n# returns array of calling code strings\n['65']\n```\n\n### .capital()\n\nReturns capital city for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.capital()\n# returns string\n'Singapore'\n```\n\n### .capital_latlng()\n\nReturns capital city latitude and longitude for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.capital_latlng()\n# returns array, approx latitude and longitude for country capital\n[1.357107, 103.819499]\n```\n\n### .currencies()\n\nReturns official currencies for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.currencies()\n# returns array of strings, currencies\n# ['SGD']\n```\n\n### .demonym()\n\nReturns the [demonyms](http://en.wikipedia.org/wiki/Demonym) for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.demonym()\n# returns string, name of residents\n'Singaporean'\n```\n\n### .geo_json()\n\nReturns [geoJSON](http://en.wikipedia.org/wiki/GeoJSON) for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Bangladesh')\ncountry.geo_json()\n# returns object of GeoJSON data\n\n{\n    'features': [\n        {\n            'geometry': {\n                'coordinates': [[[92.672721, 22.041239],\n                                             [92.652257, 21.324048],\n                                             [92.303234, 21.475485],\n                                             [92.368554, 20.670883],\n                                             [92.082886, 21.192195],\n                                             [92.025215, 21.70157],\n                                             [91.834891, 22.182936],\n                                             [91.417087, 22.765019],\n                                             [90.496006, 22.805017],\n                                             [90.586957, 22.392794],\n                                             [90.272971, 21.836368],\n                                             [89.847467, 22.039146],\n                                             [89.70205, 21.857116],\n                                             [89.418863, 21.966179],\n                                             [89.031961, 22.055708],\n                                             [88.876312, 22.879146],\n                                             [88.52977, 23.631142],\n                                             [88.69994, 24.233715],\n                                             [88.084422, 24.501657],\n                                             [88.306373, 24.866079],\n                                             [88.931554, 25.238692],\n                                             [88.209789, 25.768066],\n                                             [88.563049, 26.446526],\n                                             [89.355094, 26.014407],\n                                             [89.832481, 25.965082],\n                                             [89.920693, 25.26975],\n                                             [90.872211, 25.132601],\n                                             [91.799596, 25.147432],\n                                             [92.376202, 24.976693],\n                                             [91.915093, 24.130414],\n                                             [91.46773, 24.072639],\n                                             [91.158963, 23.503527],\n                                             [91.706475, 22.985264],\n                                             [91.869928, 23.624346],\n                                             [92.146035, 23.627499],\n                                             [92.672721, 22.041239]]],\n                            'type': 'Polygon'\n                },\n               'id': 'BGD',\n               'properties': {'name': 'Bangladesh'},\n               'type': 'Feature'}],\n    'type': 'FeatureCollection'\n}\n\n```\n\n### .iso()\n\nReturns ISO codes for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.iso()\n# returns object of ISO codes\n{'alpha2': 'SG', 'alpha3': 'SGP'}\n\ncountry.iso(2)\n# returns object of ISO codes\n'SG'\n\n\ncountry.iso(3)\n# returns object of ISO codes\n'SGP'\n```\n\n### .languages()\n\nReturns official languages for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.languages()\n# returns array of language codes\n['en', 'ms', 'ta', 'zh']\n```\n\n### .latlng()\n\nReturns approx latitude and longitude for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.latlng()\n# returns array, approx latitude and longitude for country\n[1.36666666, 103.8]\n```\n\n### .native_name()\n\nReturns the name of the country in its native tongue\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.native_name()\n# returns string, name of country in native language\n'Singapore'\n```\n\n### .population()\n\nReturns approximate population for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.population()\n# returns number, approx population\n5469700\n```\n\n### .region()\n\nReturns general region for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.region()\n# returns string\n'Asia'\n```\n\n### .subregion()\n\nReturns a more specific region for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.subregion()\n# returns string\n'South-Eastern Asia'\n```\n\n### .timezones()\n\nReturns all timezones for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.timezones()\n# returns array of timezones\n['UTC+08:00']\n```\n\n### .tld()\n\nReturns official [top level domains](http://en.wikipedia.org/wiki/Top-level_domain) for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.tld()\n# returns array of top level domains specific to the country\n['.sg']\n```\n\n### .translations()\n\nReturns translations for a specified country name in popular languages\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.translations()\n# returns object of translations of country name in major languages\n{\n    'de': 'Singapur',\n    'es': 'Singapur',\n    'fr': 'Singapour',\n    'it': 'Singapore',\n    'ja': 'シンガポール'\n}\n```\n\n### .wiki()\n\nReturns link to wikipedia page for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.wiki()\n# returns string URL of wikipedia article on country\n'http://en.wikipedia.org/wiki/singapore'\n```\n\n### .google()\n\nReturns link to google page for a specified country\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo('Singapore')\ncountry.google()\n# returns string URL of google page on country\n'https://www.google.com/search?q=Singapore'\n```\n\n### .all()\n\nReturns array of objects containing all available data for all countries. This will be super big. Not recommended.\n\n```python\n# coding=utf-8\nfrom countryinfo import CountryInfo\n\n\ncountry = CountryInfo()\ncountry.all()\n# returns array of objects,\n{\n    'zimbabwe': {'ISO': {'alpha2': 'ZW', 'alpha3': 'ZWE'},\n              'altSpellings': ['ZW', 'Republic of Zimbabwe'],\n              'area': 390757,\n              'borders': ['BWA', 'MOZ', 'ZAF', 'ZMB'],\n              'callingCodes': ['263'],\n              'capital': 'Harare',\n              'capital_latlng': [-17.831773, 31.045686],\n              'currencies': ['USD'],\n              'demonym': 'Zimbabwean',\n              'flag': '',\n              'geoJSON': {'features': [{'geometry': {'coordinates': [[[31.191409,\n                                                                       -22.25151],\n                                                                      [30.659865,\n                                                                       -22.151567],\n                                                                      [30.322883,\n                                                                       -22.271612],\n                                                                      [29.839037,\n                                                                       -22.102216],\n                                                                      [29.432188,\n                                                                       -22.091313],\n                                                                      [28.794656,\n                                                                       -21.639454],\n                                                                      [28.02137,\n                                                                       -21.485975],\n                                                                      [27.727228,\n                                                                       -20.851802],\n                                                                      [27.724747,\n                                                                       -20.499059],\n                                                                      [27.296505,\n                                                                       -20.39152],\n                                                                      [26.164791,\n                                                                       -19.293086],\n                                                                      [25.850391,\n                                                                       -18.714413],\n                                                                      [25.649163,\n                                                                       -18.536026],\n                                                                      [25.264226,\n                                                                       -17.73654],\n                                                                      [26.381935,\n                                                                       -17.846042],\n                                                                      [26.706773,\n                                                                       -17.961229],\n                                                                      [27.044427,\n                                                                       -17.938026],\n                                                                      [27.598243,\n                                                                       -17.290831],\n                                                                      [28.467906,\n                                                                       -16.4684],\n                                                                      [28.825869,\n                                                                       -16.389749],\n                                                                      [28.947463,\n                                                                       -16.043051],\n                                                                      [29.516834,\n                                                                       -15.644678],\n                                                                      [30.274256,\n                                                                       -15.507787],\n                                                                      [30.338955,\n                                                                       -15.880839],\n                                                                      [31.173064,\n                                                                       -15.860944],\n                                                                      [31.636498,\n                                                                       -16.07199],\n                                                                      [31.852041,\n                                                                       -16.319417],\n                                                                      [32.328239,\n                                                                       -16.392074],\n                                                                      [32.847639,\n                                                                       -16.713398],\n                                                                      [32.849861,\n                                                                       -17.979057],\n                                                                      [32.654886,\n                                                                       -18.67209],\n                                                                      [32.611994,\n                                                                       -19.419383],\n                                                                      [32.772708,\n                                                                       -19.715592],\n                                                                      [32.659743,\n                                                                       -20.30429],\n                                                                      [32.508693,\n                                                                       -20.395292],\n                                                                      [32.244988,\n                                                                       -21.116489],\n                                                                      [31.191409,\n                                                                       -22.25151]]],\n                                                     'type': 'Polygon'},\n                                        'id': 'ZWE',\n                                        'properties': {'name': 'Zimbabwe'},\n                                        'type': 'Feature'}],\n                          'type': 'FeatureCollection'},\n              'languages': ['en', 'sn', 'nd'],\n              'latlng': [-20, 30],\n              'name': 'Zimbabwe',\n              'nativeName': 'Zimbabwe',\n              'population': 13061239,\n              'provinces': ['Bulawayo',\n                            'Harare',\n                            'ManicalandMashonaland Central',\n                            'Mashonaland East',\n                            'Mashonaland'],\n              'region': 'Africa',\n              'subregion': 'Eastern Africa',\n              'timezones': ['UTC+02:00'],\n              'tld': ['.zw'],\n              'translations': {'de': 'Simbabwe',\n                               'es': 'Zimbabue',\n                               'fr': 'Zimbabwe',\n                               'it': 'Zimbabwe',\n                               'ja': 'ジンバブエ'},\n              'wiki': 'http://en.wikipedia.org/wiki/zimbabwe',\n              'google': 'https://www.google.com/search?q=Zimbabwe'}\n}\n```\n\n## Special Thanks\n\nSpecial thanks to johan for his work on [johan/world.geo.json](https://github.com/johan/world.geo.json), who made the geojson portion of this build possible.\n\n\n## Inspired By\nRepo: [countryjs](https://github.com/therebelrobot/countryjs)\n\nMaintainer: [Oz Haven](https://github.com/therebelrobot)\n\n\n## Contributing\nSee the list of [contributors](https://github.com/porimol/countryinfo/contributors) who participated in this project.\n\n\n### How to become a contributor\n\nIf you want to contribute to `countryinfo` and make it better, your help is very welcome.\nYou can make constructive, helpful bug reports, feature requests and the noblest of all contributions.\nIf like to contribute in a good way, then follow the following guidelines.\n\n#### How to make a clean pull request\n\n* Create a personal fork on Github.\n* Clone the fork on your local machine.(Your remote repo on Github is called `origin`.)\n* Add the original repository as a remote called `upstream`.\n* If you created your fork a while ago be sure to pull upstream changes into your local repository.\n* Create a new branch to work on! Branch from `dev`.\n* Implement/fix your feature, comment your code.\n* Follow `countryinfo`'s code style, including indentation(4 spaces).\n* Write or adapt tests as needed.\n* Add or change the documentation as needed.\n* Push your branch to your fork on Github, the remote `origin`.\n* From your fork open a pull request to the `dev` branch.\n* Once the pull request is approved and merged, please pull the changes from `upstream` to your local repo and delete your extra branch(es).\n\n\n## Disclaimer\n\nThis is being maintained in the contributor's free time, and as such, may contain minor errors in regards to some countries.\nMost of the information included in this library is what is listed on Wikipedia. If there is an error,\nplease let me know and I will do my best to correct it.\n\n## License\n\n### [The MIT License](LICENSE.txt)\n\nCopyright (c) 2018, Porimol Chandro \u003cporimolchandroroy@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporimol%2Fcountryinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fporimol%2Fcountryinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporimol%2Fcountryinfo/lists"}