Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
fedecalendino committed Dec 20, 2021
1 parent 990a632 commit 74de2a4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
### [Alfred Workflow](https://www.alfredapp.com/workflows/) to convert between multiple currencies 💱️
### [Alfred Workflow](https://www.alfredapp.com/workflows/) to convert between multiple fiat and crypto currencies 💱️

![Currency Converter example](/img/example.png)


* `CRYPTOS` env var is a comma separated list of crypto currencies (BTC, ETH, CRO, etc).
* `FIATS` env var is a comma separated list of fiat currencies (USD, ARS, CZK, etc).
* `COINMARKETCAP_APIKEY` is an key to use [coinmarketcap.com's api](https://coinmarketcap.com/api/) [OPTIONAL].

![Currency Converter vars](/img/vars.png)

2 changes: 1 addition & 1 deletion info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<key>createdby</key>
<string>Fede Calendino</string>
<key>description</key>
<string>Convert between multiple currencies 💱️</string>
<string>Convert between multiple fiat and crypto currencies 💱️</string>
<key>disabled</key>
<false/>
<key>name</key>
Expand Down
7 changes: 6 additions & 1 deletion providers/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@


def fetch(currencies):
api_key = os.getenv("COINMARKETCAP_APIKEY")

if not api_key:
return {}

currencies = set(map(lambda string: string.upper(), currencies))

headers = {
"Accept": "application/json",
"X-CMC_PRO_API_KEY": os.getenv("COINMARKETCAP_APIKEY"),
"X-CMC_PRO_API_KEY": api_key,
}

params = {
Expand Down

0 comments on commit 74de2a4

Please sign in to comment.