Skip to content

Official Python SDK for OpenExchangeAPI — access exchange rates, currency metadata, and perform conversions with ease.

License

Notifications You must be signed in to change notification settings

OpenExchangeAPI/sdk-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenExchangeAPI Python SDK

Minimal, idiomatic Python client for OpenExchangeAPI

  • All endpoints supported
  • API key is optional
  • Returns Python dataclasses for all responses
  • Precise decimal support

Installation

pip install openexchangeapi

Or copy openexchangeapi.py into your project.

Usage

from openexchangeapi import OpenExchangeApiClient, OpenExchangeApiException

client = OpenExchangeApiClient('YOUR_API_KEY')  # API key optional

# Get latest rates
latest = client.get_latest()

# Convert currency
result = client.convert('USD', 'EUR', 100)

# List currencies
currencies = client.list_currencies()

# Get currency details
eur = client.get_currency('EUR')

API Reference

  • get_latest(base=None)
  • get_latest_precise(base=None)
  • get_historical(date, base=None)
  • get_historical_precise(date, base=None)
  • convert(from_, to, amount)
  • convert_precise(from_, to, amount)
  • list_currencies(type=None)
  • get_currency(code)

All methods raise OpenExchangeApiException on error.

Error Handling

try:
    data = client.get_latest()
except OpenExchangeApiException as e:
    # Handle error
    print(e)

License

MIT

About

Official Python SDK for OpenExchangeAPI — access exchange rates, currency metadata, and perform conversions with ease.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages