Skip to content

numbeo/numbeo-api-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

numbeo-api-python

Numbeo API Example – Retrieve Cost of Living for a City

This repository contains a Python example application that demonstrates how to fetch and display cost of living data from the Numbeo API for any city and country.

Features

  • Fetch real-time cost of living data from Numbeo API
  • Display prices organized by category
  • Show average, minimum, and maximum prices
  • Command-line interface with flexible API key configuration
  • Clean, formatted terminal output

Installation

  1. Clone this repository:
git clone https://github.com/numbeo/numbeo-api-python.git
cd numbeo-api-python
  1. Install dependencies:
pip install -r requirements.txt

Usage

Basic Usage

python city_prices_example.py --city "San Francisco, CA" --country "United States" --api-key YOUR_API_KEY

Using Environment Variable

Set your API key as an environment variable:

export NUMBEO_API_KEY=your_api_key
python city_prices_example.py --city "San Francisco, CA" --country "United States"

More Examples

# London, UK
python city_prices_example.py --city "London" --country "United Kingdom" --api-key YOUR_KEY

# Tokyo, Japan
python city_prices_example.py --city "Tokyo" --country "Japan" --api-key YOUR_KEY

# Paris, France
python city_prices_example.py --city "Paris" --country "France" --api-key YOUR_KEY

Sample Output

Fetching price data for San Francisco, CA, United States...

================================================================================
COST OF LIVING DATA: San Francisco, CA, United States
================================================================================
Currency: USD

Restaurants:
--------------------------------------------------------------------------------

  Meal, Inexpensive Restaurant
    Average: $25.00
    Range: $15.00 - $40.00
    Data points: 450

  Meal for 2 People, Mid-range Restaurant, Three-course
    Average: $100.00
    Range: $70.00 - $150.00
    Data points: 320

...

API Key

You need a valid Numbeo API key to use this application. Visit Numbeo API Documentation to obtain your API key.

Requirements

  • Python 3.7+
  • requests library (see requirements.txt)

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Numbeo API Example – Retrieve Cost of Living for a City

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%