{"id":16971664,"url":"https://github.com/juancarlospaco/openexchangerate","last_synced_at":"2025-04-12T00:42:59.568Z","repository":{"id":57449071,"uuid":"111406114","full_name":"juancarlospaco/openexchangerate","owner":"juancarlospaco","description":"OpenExchangeRates API client for Python 3.7+.","archived":false,"fork":false,"pushed_at":"2018-04-11T14:41:13.000Z","size":376,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T04:43:46.940Z","etag":null,"topics":["bitcoin-price","currency","cython","money","namedtuple","openexchangerates","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juancarlospaco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-20T12:12:37.000Z","updated_at":"2024-04-09T06:01:12.000Z","dependencies_parsed_at":"2022-09-26T17:30:26.605Z","dependency_job_id":null,"html_url":"https://github.com/juancarlospaco/openexchangerate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juancarlospaco%2Fopenexchangerate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juancarlospaco%2Fopenexchangerate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juancarlospaco%2Fopenexchangerate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juancarlospaco%2Fopenexchangerate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juancarlospaco","download_url":"https://codeload.github.com/juancarlospaco/openexchangerate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248147680,"owners_count":21055545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin-price","currency","cython","money","namedtuple","openexchangerates","python3"],"created_at":"2024-10-14T00:53:30.067Z","updated_at":"2025-04-12T00:42:59.543Z","avatar_url":"https://github.com/juancarlospaco.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openexchangerate\n\nOpenExchangeRates API client for Python 3.7+, worldwide exchange prices + Bitcoin price + Gold price.\nCan be used as context manager or iterator. Namedtuple, dict and HTML outputs.\nNo dependencies. Float or Decimal. Optional Timeout. Optional round. 1 file.\n\n![screenshot](https://source.unsplash.com/ir5MHI6rPg0/800x401 \"Photo by https://unsplash.com/@agent_illustrateur\")\n\n- [Example HTML output from `OpenExchangeRates(api_key).latest().html`](https://github.com/juancarlospaco/openexchangerate/blob/master/sample.html)\n\n\n# Install\n\n```bash\npip install openexchangerate\n```\n\n\n# Use\n\n```python\nfrom openexchangerate import OpenExchangeRates\n\nclient = OpenExchangeRates(api_key=\"21e7c27676972\")\n\nclient.latest().namedtuple      # .dict for Dictionary, .html for HTML.\nclient.currencies().namedtuple  # .frozendict for Inmutable Dictionary.\n\nfor name, price in client:  # Iterator support.\n    print(name, price)\n\nwith client as prices:  # Context Manager support.\n    print(prices.frozendict)\n\n```\n\n![screenshot](openexchangerates.png)\n\n![screenshot](temp.png)\n\n\n# Tests\n\n```\npython -m unittest --verbose --locals tests.TestOpenExchangeRates\n```\n\n\n- [Test Templates.](https://gist.github.com/juancarlospaco/040fbe326631e638f2a540fe8c1f2092)\n\n\n# Description of OpenExchangeRates\n\n##### OpenExchangeRates\n\u003cdetails\u003e\n\n`openexchangerate.OpenExchangeRates(api_key: str, timeout: int=60, use_float: bool=True, round_float: bool=True, base: str='USD', local_base: str=None)`\n\n**Description:** Returns namedtuple or dict with current international exchange prices and Bitcoin price.\n\n**Arguments:**\n- `api_key` Your API Key, [you can get one API Key for Free](https://openexchangerates.org/account/app-ids), string type.\n- `timeout` Timeout on Seconds for network connections, integer type, optional.\n- `use_float` `True` for `float`, `False` for `decimal.Decimal`, boolean type, optional.\n- `round_float` `True` to round floats to 2 decimals, using `round(float, 2)`, boolean type, optional.\n- `base` Base currency, **Only for Pay accounts!**, defaults to `\"USD\"`, string type, optional.\n- `local_base` Local Base currency, for Free accounts, to calculate values locally (offline), string type, optional.\n\n**Keyword Arguments:** None.\n\n**Returns:** `collections.namedtuple`.\n\n**Dependencies:** None.\n\n**Source Code file:** https://github.com/juancarlospaco/openexchangerate/blob/master/openexchangerate.py\n\n| State              | OS          | Description |\n| ------------------ |:-----------:| -----------:|\n| :white_check_mark: | **Linux**   | Works Ok    |\n| :white_check_mark: | **Os X**    | Works Ok    |\n| :white_check_mark: | **Windows** | Works Ok    |\n\n**Usage Example:**\n\n```python\n\u003e\u003e\u003e from openexchangerate import OpenExchangeRates\n\u003e\u003e\u003e OpenExchangeRates(\"21e7c27676972\").latest()\n\n```\n\u003c/details\u003e\n\n\n# Speed\n\n\u003cdetails\u003e\n\u003csummary\u003eMaximum performance for advanced Linux users.\u003c/summary\u003e\n\n```\nsudo pip install cython\n```\n\nCython basically translates Python 3 to C and then Compiles C to Binary,\nthen you can import the generated `*.so` module as a normal Python module.\n\nIts 100% Optional, but recommend. We check that Cython Compiles on Travis.\n\nYou dont have to learn anything about Cython, it just works automatically.\nThe Packages on PyPi dont have any `*.c`, `*.cpp`, `*.pyc`, `*.so`.\n\n[Cython is used by lots of projects and companies.](https://github.com/cython/cython/wiki/projects#projects-using-cython) [Please check Cython documentation for more info.](https://cython.readthedocs.io)\n\n\u003c/details\u003e\n\n\n### Contributors:\n\n- **Please Star this Repo on Github !**, it helps to show up faster on searchs.\n- [Help](https://help.github.com/articles/using-pull-requests) and more [Help](https://help.github.com/articles/fork-a-repo) and Interactive Quick [Git Tutorial](https://try.github.io).\n- English is the primary default spoken language, unless explicitly stated otherwise *(eg. Dont send Translation Pull Request)*\n- Pull Requests for working passing unittests welcomed.\n\n\n### Licence:\n\n- GNU GPL Latest Version and GNU LGPL Latest Version and any Licence YOU Request via Bug Report.\n\n\n### Ethics and Humanism Policy:\n\n- Religions is not allowed. Contributing means you agree with the COC.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuancarlospaco%2Fopenexchangerate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuancarlospaco%2Fopenexchangerate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuancarlospaco%2Fopenexchangerate/lists"}