Skip to main content

A neat country call code retriever

Project description

PyCountryCode documentation!

What it is?

I have always loved knowing stuff. I love knowledge, it is my first love before anything else. In every kind of setup I find myself in I am always participating because I almost always have an idea about most things. This love of knowledge also made it easy for me to know more country telephone codes.

However, the truth is I couldn't cram them all the country codes and retrieve them from my mind every time it became necessary. I knew by heart those of the most popular countries that includes Russia (+7), UK (+44), USA (+1), Australia (+61) and of course Zimbabwe amongst many others.

Why?

Someone wanted to know what code +52 was for which country, I didn't know, I was embarrassed at myself. I challenged myself by writing this package so I and anyone else can use to get the country calling code of any country and also to get a country after passing in a calling code you know but are not sure about the country of origin.

Inspiration

I wanted to write something that others could find useful.

Installation

$ pip install pycountrycode

Use as per environment

Terminal
$ pip3 install pycountrycode
$ python3
>>> 
Windows Command Prompt
C:\Users\Andile Xeroxzen> pip install pycountrycode
C:\Users\Andile Xeroxzen> python
>>> 

Importing the 'get_code' function

>>> from pycountrycode.countrycode import get_code
>>> get_code('Zimbabwe')
'+263'
>>> get_code('New Zealand')
'+64'
>>> get_code('Peru')
'+51'
>>> get_code('Madagascar')
'+261'
>>> get_code('Russia')
'+7'
>>> get_code('Australia')
'+61'
>>> get_code('Israel')
'+972'
>>> get_code('Mal')
'Undefined country'

Importing the 'get_country' function.

>>> from pycountrycode.countrycode import get_country
>>> get_country('+52')
'Mexico' 
>>> get_country('+56')
'Easter Island'
>>> get_country('+1')
'United States of America'
>>> get_country('+7')
'Russia'
>>> get_country('+44')
'Britain'
>>> get_country('+86')
'China'
>>> get_country('+3')
'Undefined country code'
>>> get_country('+2')
'Undefined country code'
>>> get_country('+27')
'South Africa'

Package Information

>>> import pycountrycode
>>> pycountrycode.__author__
'Andile Jaden Mbele'
>>> pycountrycode.__email__
'andilembele020@gmail.com'
>>> pycountrycode.__github__
'www.github.com/xeroxzen/pycountrycode'
>>> pycountrycode.__package__
'pycountrycode'
>>>

Also

>>> from pycountrycode.countrycode import get_code, get_country
>>> get_code('Botswana')
'+267'
>>> get_country('+33')
'France'
>>> 

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

pycountrycode-1.1.7.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

pycountrycode-1.1.7-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file pycountrycode-1.1.7.tar.gz.

File metadata

  • Download URL: pycountrycode-1.1.7.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for pycountrycode-1.1.7.tar.gz
Algorithm Hash digest
SHA256 5c1aa6cf0f68c47487cc6a9f463953e641dc4ff20a283f5f835db17f07d29faf
MD5 727e5a439dafdeba0f613ad69a05477d
BLAKE2b-256 08789c8cf04e0d24cf7e08507efdc754cfc9557a444ddfc46e9fa5b0d9bc41df

See more details on using hashes here.

File details

Details for the file pycountrycode-1.1.7-py3-none-any.whl.

File metadata

  • Download URL: pycountrycode-1.1.7-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for pycountrycode-1.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2d1de1eeba587f78f24d18c1e80960c7b7d8e6f13dd885c9ede7f8a7169e0288
MD5 d77703d3a4fee87bc66db42999b7518f
BLAKE2b-256 515de734faa562c052ce39f332b907eea3fd580a99bf41becb96da8d484e7be4

See more details on using hashes here.

Supported by

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