python countries
1.0.1
파이썬-캐나다
휴식 국가를 마무리합니다
빌드에서 :
$ pip install python-countries출처 :
$ git clone https://github.com/leonkozlowski/python-countries.git
$ cd python-countries
$ pip install -e . 클라이언트를 만듭니다
>>> client = CountriesApi ()사용 가능한 엔드 포인트를 표시하십시오
>>> client.endpoints ()
>>> [ ' country_name ' , ' full_name ' , ' iso_code ' , ' currency ' , ' language ' , ' capital_city ' , ' calling_code ' , ' region ' ]전체 이름으로 국가 데이터 요청
>>> client.full_name( ' Colombia ' ) full_name endpoint에 대한 응답
{
" 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 "
} 쉬운 속성 액세스를위한 CountryResponse Facade
> >> colombia = client . full_name ( 'Colombia' )
> >> colombia . name
> >> "Colombia"
> >> colombia . flag
> >> "https://restcountries.eu/data/col.svg"