Skip to main content

Package to find out various information about countries: Country Code, Country Language, City and Country Currency Information, Time Conversion, Currency Conversion, and search for Continents from Country Names

Project description

Country Converter Toolkit

Feature

  • Country Code
    • find out the country code from the country name
  • Country Info
    • find out country information about capital city and currency from country name
  • Country Languange
    • find out the language of a country based on the country name
  • Continent of countries
    • find out continent from country name or country code
  • Currency Conversion
    • convert money from one country to another
  • Time Zone
    • convert time from one country to another

Installation

To install the Country Converter Toolkit package, use pip:

pip install Country-Converter-Toolkit

how to use

Here are some examples of how to use the Country-Converter-Toolkit package:

Country Code

from Country.CountryCode import search_country_code
print(search_country_code("Indonesia"))

Country Info

from Country.CountryInfo import get_country_info
print(get_country_info("indonesia"))

Country Languange

from Country.CountryLanguange import get_country_language
print(get_country_language("Indonesia"))

Continent of countries

from Country.ContinentOfCountries import get_info_by_country_code
print(get_info_by_country_code("ID"))

Currency Conversion

from Country.MoneyConversion import currency_conversion
print(currency_conversion(10, 'USD', 'IDR'))

Time Zone

from Country.TimeZone import convert_time_by_code
print(convert_time_by_code("WITA", "JST", "2024-10-09 14:30:00"))
from Country.TimeZone import convert_city_time
print(convert_city_time("Makassar", "New York", "2024-10-09 00:30:00"))

About The Module

This package consists of the following modules:

Module_1

search_country_code(country_name) : str

This function contains the country name and country code

usage example:

from Country.CountryCode import search_country_code
print(search_country_code('Indonesia'))

output:

ID

Module_1 Notes:

  • If the country name entered does not exist or the user enters something other than the country name, "country not found" will appear.

Modul_2

This function is used to get a country's info based on the country name entered

Usage Example:

from Country.CountryInfo import get_country_info
print(get_country_info("Indonesia"))

Output:

Capital City : Jakarta, Currency : RUPIAH (IDR)

Module 3 Notes:

  • Ensure you input the correct country name to obtain accurate result
  • Make sure to use the correct capitalization for the country

Modul_3

This function is used to get a country's language based on the country name entered

search_country_language(country_name) : str

Usage Example:

from Country.CountryLanguange import get_country_language
print(get_country_language("Indonesia"))

Output:

Indonesian

Module 3 Notes:

  • Ensure you input the correct country name to obtain accurate result
  • Make sure to use the correct capitalization for the codes
  • If the country listed are not a part of the list, the function will return a "Code not Found" message

module_4

data_country

This function is designed for programmers who want to categorize countries by continent.

get_info_by_country_code(country_code)

This function uses the get() method to retrieve information about a country based on the provided country code.

Parameter:

  • country_code: The expected input is a country code (example: "AF").

Example Usage:

from Country.ContinentOfCountries import get_info_by_country_code
print(get_info_by_country_code('JP'))

Output: Japan, Asia

get_info_by_country_code(country_code)

This function uses the get() method to retrieve information about a country based on the provided country name.

Parameter:

  • country_name: The expected input is a country name (example: "Afghanistan").

Example Usage:

from Country.ContinentOfCountries import get_info_by_country_code
print(get_info_by_country_code('ID'))

Output: Indonesia, Asia

Module 4 notes

  • An example of its use is that the programmer will import this library, then if the programmer calls the function by entering the country code and it will be converted to the continent of that country.
  • To search for country information based on the given country_code. This function will return the names of countries and continents as tuples. Otherwise, it will return a message that the country code is not found.
  • For the country name function, this function iterates through all the values ​​in data_country. For each value, it checks whether the country name (in lowercase) matches the given country_name (also in lowercase). If found, this function will return the country and continent names as tuples. If not found, it will return a message that the country name was not found.

module_5

currency_conversion(amount, from_currency, to_currency)

This function is used to convert a number of currencies from one country to another.

Parameter:

  • amount: The amount of money you want to convert.
  • from_currency: The origin of the currency you want to convert.
  • to_currency: Destination currency to be converted.

Example Usage:

from Country.MoneyConversion import currency_conversion
print(currency_conversion(10, 'USD', 'IDR'))

Output:

142.450.00

If the currency is not recognized, the output is: ''' Currency not recognized '''

Catatan modul 1

  • Make sure to use capital letters for the country's currency

module_6

convert_time_by_code(from_tz: str, to_tz: str, time_str: str)

This function is used to convert time from one time zone code to another.

Parameters:

  • from_tz: The time zone code to convert from.
  • to_tz: The time zone code to convert to.
  • time_str: The time to be converted (format: YYYY-MM-DD HH:MM:SS).

Example Usage:

from Country.TimeZone import convert_time_by_code
print(convert_time_by_code("WITA", "JST", "2024-10-09 14:30:00"))

Output:

2024-10-09 15:30:00

convert_city_time(city_from: str, city_to: str, time_str: str)

This function is used to convert time from one city to another city with a different time zone.

Example Usage:

from Country.TimeZone import convert_city_time
print(convert_city_time("Makassar", "New York", "2024-10-09 00:30:00"))

Output:

2024-10-08 12:30:00

Module 6 Notes

  • Ensure you input the correct time zone and city to obtain accurate conversion results.
  • When using the convert_time_by_code() function, make sure to use the correct capitalization for time zone codes.
  • For convert_time_by_code(), if there are time zones with the same name, use the format CODE_country, for example, convert_time_by_code("WITA", "AST_Atlantic", "2024-10-09 12:00:00").
  • Not all cities can be converted; make sure to input major cities or capitals. If unavailable, use the convert_time_by_code() function instead.
  • If the time zone or city is not found, the function will return an error message.

contact

For further questions, please contact

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

country_converter_toolkit-0.1.1.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Country_Converter_Toolkit-0.1.1-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file country_converter_toolkit-0.1.1.tar.gz.

File metadata

File hashes

Hashes for country_converter_toolkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 223fb1e2668ec445db293b1e85843735a45966287ff9d606c73cb06eee78deb5
MD5 130e72460d4cf572b8799168154d4cac
BLAKE2b-256 3f04b753d09113a6133a8980d51e2017eaaffe04daac54ea16a16ef689097410

See more details on using hashes here.

File details

Details for the file Country_Converter_Toolkit-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Country_Converter_Toolkit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd37873ab73d7a294115f0df0884a95b2def1bd097a37843ae7077a3738f0f96
MD5 a6ffee16aee2519c4324de68a0ff73f9
BLAKE2b-256 0ebc3528513272d9706cd015340e2b12c2cb39c7bc3785f197779af6222a8d7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page