Python-countries

Latest version: v1.0.1

Safety actively analyzes 681812 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.0.1

**NEW**
-Added `endpoints()` feature for `CountriesAPI()`
-Added `[testenv:black]` to `tox.ini` for pre-commit
-`Makefile`

*linting, flaking*

1.0.0

**Official Release**
-Added enhancements to build
-Included `flake8` and `pylint` in `.travis.yml`

-README.md fix

0.0.3

**CHANGES**
-Improved exception handling with `CountriesApiError`
-With any `resp_obj.status_code != 200` - Returns

python
400 example

{
"status": 400,
"message": "Bad Request"
}

404 example

{
"status": 404,
"message": "Not Found"
}


-HTTP check `_check_http_status` now takes the full `Requests.model.Response` object

0.0.2

**Enhancements**
-Fixed request builder for `country_name` and `full_name`
-Parametrize country names by `?` literal
* (i.e) `name='united states'` -> `'united?states'`

**NEW**
-Added further unit tests

0.0.1

Wraps [REST Countries](https://restcountries.eu/api-endpoints-calling-code)


Installation

From Source:
bash
$ git clone https://github.com/leonkozlowski/python-countries.git
$ cd python-countries
$ pip install -e .


Usage

Create the client
bash
>>> client = CountriesApi()


Request for country data by full name
bash
>>> client.full_name('Colombia')


Response for `full_name` endpoint
bash
{
"name": "Colombia",
"topLevelDomain": [".co"],
"alpha2Code": "CO",
"alpha3Code": "COL",
"callingCodes": ["57"],
"capital": "Bogotá",
"altSpellings": ["CO", "Republic of Colombia", "República de Colombia"],
"region": "Americas",
"subregion": "South America",
"population": 48759958,
"latlng": [4.0, -72.0],
"demonym": "Colombian",
"area": 1141748.0,
"gini": 55.9,
"timezones": ["UTC-05:00"],
"borders": ["BRA", "ECU", "PAN", "PER", "VEN"],
"nativeName": "Colombia",
"numericCode": "170",
"currencies": [{
"code": "COP",
"name": "Colombian peso",
"symbol": "$"
}],
"languages": [{
"iso639_1": "es",
"iso639_2": "spa",
"name": "Spanish",
"nativeName": "Español"
}],
"translations": {
"de": "Kolumbien",
"es": "Colombia",
"fr": "Colombie",
"ja": "コロンビア",
"it": "Colombia",
"br": "Colômbia",
"pt": "Colômbia"
},
"flag": "https://restcountries.eu/data/col.svg",
"regionalBlocs": [{
"acronym": "PA",
"name": "Pacific Alliance",
"otherAcronyms": [],
"otherNames": ["Alianza del Pacífico"]
}, {
"acronym": "USAN",
"name": "Union of South American Nations",
"otherAcronyms": ["UNASUR", "UNASUL", "UZAN"],
"otherNames": ["Unión de Naciones Suramericanas"..."]
}],
"cioc": "COL"
}

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.