We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Running pytest locally fails due to no TESTING or API_KEY
### Repository commit

1faf10b5c2dff8cef3f5d59f60a126bd19bb1c44

### Python version (python --version)

Python 3.11.3

### Dependencies version (pip freeze)

```
absl-py==1.4.0
astunparse==1.6.3
beautifulsoup4==4.12.2
cachetools==5.3.0
certifi==2023.5.7
cffi==1.15.1
cfgv==3.3.1
charset-normalizer==3.1.0
colorama==0.4.6
contourpy==1.0.7
cryptography==40.0.2
cycler==0.11.0
dill==0.3.6
distlib==0.3.6
fake-useragent==1.1.3
filelock==3.12.0
flatbuffers==23.5.9
fonttools==4.39.4
gast==0.4.0
google-auth==2.18.0
google-auth-oauthlib==1.0.0
google-pasta==0.2.0
grpcio==1.54.2
h5py==3.8.0
identify==2.5.24
idna==3.4
iniconfig==2.0.0
jax==0.4.10
joblib==1.2.0
keras==2.12.0
kiwisolver==1.4.4
libclang==16.0.0
lxml==4.9.2
Markdown==3.4.3
markdown-it-py==2.2.0
MarkupSafe==2.1.2
matplotlib==3.7.1
mdurl==0.1.2
ml-dtypes==0.1.0
mpmath==1.3.0
networkx==3.1
nodeenv==1.8.0
ntlm-auth==1.5.0
numpy==1.23.5
oauthlib==3.2.2
opencv-python==4.7.0.72
opt-einsum==3.3.0
packaging==23.1
pandas==2.0.1
patsy==0.5.3
pbr==5.11.1
Pillow==9.5.0
pip==22.3.1
platformdirs==3.5.1
pluggy==1.0.0
ply==3.11
pre-commit==3.3.1
projectq==0.8.0
protobuf==4.23.0
psutil==5.9.5
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
Pygments==2.15.1
pyparsing==3.0.9
pytest==7.3.1
python-dateutil==2.8.2
pytz==2023.3
PyYAML==6.0
qiskit==0.43.0
qiskit-aer==0.12.0
qiskit-ibmq-provider==0.20.2
qiskit-terra==0.24.0
requests==2.30.0
requests-ntlm==1.1.0
requests-oauthlib==1.3.1
rich==13.3.5
rsa==4.9
ruff==0.0.267
rustworkx==0.12.1
scikit-fuzzy==0.4.2
scikit-learn==1.2.2
scipy==1.10.1
setuptools==65.5.0
six==1.16.0
soupsieve==2.4.1
statsmodels==0.14.0
stevedore==5.0.0
sympy==1.12
tensorboard==2.12.3
tensorboard-data-server==0.7.0
tensorflow==2.12.0
tensorflow-estimator==2.12.0
tensorflow-intel==2.12.0
tensorflow-io-gcs-filesystem==0.31.0
termcolor==2.3.0
texttable==1.6.7
threadpoolctl==3.1.0
tweepy==4.14.0
typing_extensions==4.5.0
tzdata==2023.3
urllib3==1.26.15
virtualenv==20.23.0
websocket-client==1.5.1
websockets==11.0.3
Werkzeug==2.3.4
wheel==0.40.0
wrapt==1.14.1
xgboost==1.7.5
yulewalker==0.1.1
```

### Expected behavior

Every test running successfully

### Actual behavior

```
ERROR web_programming/currency_converter.py - KeyError: "API key must be provided in the 'AMDOREN_API_KEY' environment variable."
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `web_programming/currency_converter.py`
Content:
```
1 """
2 This is used to convert the currency using the Amdoren Currency API
3 https://www.amdoren.com
4 """
5 
6 import os
7 
8 import requests
9 
10 URL_BASE = "https://www.amdoren.com/api/currency.php"
11 TESTING = os.getenv("CI", "")
12 API_KEY = os.getenv("AMDOREN_API_KEY", "")
13 
14 if not API_KEY and not TESTING:
15     raise KeyError(
16         "API key must be provided in the 'AMDOREN_API_KEY' environment variable."
17     )
18 
19 # Currency and their description
20 list_of_currencies = """
21 AED	United Arab Emirates Dirham
22 AFN	Afghan Afghani
23 ALL	Albanian Lek
24 AMD	Armenian Dram
25 ANG	Netherlands Antillean Guilder
26 AOA	Angolan Kwanza
27 ARS	Argentine Peso
28 AUD	Australian Dollar
29 AWG	Aruban Florin
30 AZN	Azerbaijani Manat
31 BAM	Bosnia & Herzegovina Convertible Mark
32 BBD	Barbadian Dollar
33 BDT	Bangladeshi Taka
34 BGN	Bulgarian Lev
35 BHD	Bahraini Dinar
36 BIF	Burundian Franc
37 BMD	Bermudian Dollar
38 BND	Brunei Dollar
39 BOB	Bolivian Boliviano
40 BRL	Brazilian Real
41 BSD	Bahamian Dollar
42 BTN	Bhutanese Ngultrum
43 BWP	Botswana Pula
44 BYN	Belarus Ruble
45 BZD	Belize Dollar
46 CAD	Canadian Dollar
47 CDF	Congolese Franc
48 CHF	Swiss Franc
49 CLP	Chilean Peso
50 CNY	Chinese Yuan
51 COP	Colombian Peso
52 CRC	Costa Rican Colon
53 CUC	Cuban Convertible Peso
54 CVE	Cape Verdean Escudo
55 CZK	Czech Republic Koruna
56 DJF	Djiboutian Franc
57 DKK	Danish Krone
58 DOP	Dominican Peso
59 DZD	Algerian Dinar
60 EGP	Egyptian Pound
61 ERN	Eritrean Nakfa
62 ETB	Ethiopian Birr
63 EUR	Euro
64 FJD	Fiji Dollar
65 GBP	British Pound Sterling
66 GEL	Georgian Lari
67 GHS	Ghanaian Cedi
68 GIP	Gibraltar Pound
69 GMD	Gambian Dalasi
70 GNF	Guinea Franc
71 GTQ	Guatemalan Quetzal
72 GYD	Guyanaese Dollar
73 HKD	Hong Kong Dollar
74 HNL	Honduran Lempira
75 HRK	Croatian Kuna
76 HTG	Haiti Gourde
77 HUF	Hungarian Forint
78 IDR	Indonesian Rupiah
79 ILS	Israeli Shekel
80 INR	Indian Rupee
81 IQD	Iraqi Dinar
82 IRR	Iranian Rial
83 ISK	Icelandic Krona
84 JMD	Jamaican Dollar
85 JOD	Jordanian Dinar
86 JPY	Japanese Yen
87 KES	Kenyan Shilling
88 KGS	Kyrgystani Som
89 KHR	Cambodian Riel
90 KMF	Comorian Franc
91 KPW	North Korean Won
92 KRW	South Korean Won
93 KWD	Kuwaiti Dinar
94 KYD	Cayman Islands Dollar
95 KZT	Kazakhstan Tenge
96 LAK	Laotian Kip
97 LBP	Lebanese Pound
98 LKR	Sri Lankan Rupee
99 LRD	Liberian Dollar
100 LSL	Lesotho Loti
101 LYD	Libyan Dinar
102 MAD	Moroccan Dirham
103 MDL	Moldovan Leu
104 MGA	Malagasy Ariary
105 MKD	Macedonian Denar
106 MMK	Myanma Kyat
107 MNT	Mongolian Tugrik
108 MOP	Macau Pataca
109 MRO	Mauritanian Ouguiya
110 MUR	Mauritian Rupee
111 MVR	Maldivian Rufiyaa
112 MWK	Malawi Kwacha
113 MXN	Mexican Peso
114 MYR	Malaysian Ringgit
115 MZN	Mozambican Metical
116 NAD	Namibian Dollar
117 NGN	Nigerian Naira
118 NIO	Nicaragua Cordoba
119 NOK	Norwegian Krone
120 NPR	Nepalese Rupee
121 NZD	New Zealand Dollar
122 OMR	Omani Rial
123 PAB	Panamanian Balboa
124 PEN	Peruvian Nuevo Sol
125 PGK	Papua New Guinean Kina
126 PHP	Philippine Peso
127 PKR	Pakistani Rupee
128 PLN	Polish Zloty
129 PYG	Paraguayan Guarani
130 QAR	Qatari Riyal
131 RON	Romanian Leu
132 RSD	Serbian Dinar
133 RUB	Russian Ruble
134 RWF	Rwanda Franc
135 SAR	Saudi Riyal
136 SBD	Solomon Islands Dollar
137 SCR	Seychellois Rupee
138 SDG	Sudanese Pound
139 SEK	Swedish Krona
140 SGD	Singapore Dollar
141 SHP	Saint Helena Pound
142 SLL	Sierra Leonean Leone
143 SOS	Somali Shilling
144 SRD	Surinamese Dollar
145 SSP	South Sudanese Pound
146 STD	Sao Tome and Principe Dobra
147 SYP	Syrian Pound
148 SZL	Swazi Lilangeni
149 THB	Thai Baht
150 TJS	Tajikistan Somoni
151 TMT	Turkmenistani Manat
152 TND	Tunisian Dinar
153 TOP	Tonga Paanga
154 TRY	Turkish Lira
155 TTD	Trinidad and Tobago Dollar
156 TWD	New Taiwan Dollar
157 TZS	Tanzanian Shilling
158 UAH	Ukrainian Hryvnia
159 UGX	Ugandan Shilling
160 USD	United States Dollar
161 UYU	Uruguayan Peso
162 UZS	Uzbekistan Som
163 VEF	Venezuelan Bolivar
164 VND	Vietnamese Dong
165 VUV	Vanuatu Vatu
166 WST	Samoan Tala
167 XAF	Central African CFA franc
168 XCD	East Caribbean Dollar
169 XOF	West African CFA franc
170 XPF	CFP Franc
171 YER	Yemeni Rial
172 ZAR	South African Rand
173 ZMW	Zambian Kwacha
174 """
175 
176 
177 def convert_currency(
178     from_: str = "USD", to: str = "INR", amount: float = 1.0, api_key: str = API_KEY
179 ) -> str:
180     """https://www.amdoren.com/currency-api/"""
181     params = locals()
182     params["from"] = params.pop("from_")
183     res = requests.get(URL_BASE, params=params).json()
184     return str(res["amount"]) if res["error"] == 0 else res["error_message"]
185 
186 
187 if __name__ == "__main__":
188     print(
189         convert_currency(
190             input("Enter from currency: ").strip(),
191             input("Enter to currency: ").strip(),
192             float(input("Enter the amount: ").strip()),
193         )
194     )
195
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/web_programming/currency_converter.py b/web_programming/currency_converter.py
--- a/web_programming/currency_converter.py
+++ b/web_programming/currency_converter.py
@@ -8,13 +8,7 @@
 import requests
 
 URL_BASE = "https://www.amdoren.com/api/currency.php"
-TESTING = os.getenv("CI", "")
-API_KEY = os.getenv("AMDOREN_API_KEY", "")
 
-if not API_KEY and not TESTING:
-    raise KeyError(
-        "API key must be provided in the 'AMDOREN_API_KEY' environment variable."
-    )
 
 # Currency and their description
 list_of_currencies = """
@@ -175,20 +169,31 @@
 
 
 def convert_currency(
-    from_: str = "USD", to: str = "INR", amount: float = 1.0, api_key: str = API_KEY
+    from_: str = "USD", to: str = "INR", amount: float = 1.0, api_key: str = ""
 ) -> str:
     """https://www.amdoren.com/currency-api/"""
+    # Instead of manually generating parameters
     params = locals()
+    # from is a reserved keyword
     params["from"] = params.pop("from_")
     res = requests.get(URL_BASE, params=params).json()
     return str(res["amount"]) if res["error"] == 0 else res["error_message"]
 
 
 if __name__ == "__main__":
+    TESTING = os.getenv("CI", "")
+    API_KEY = os.getenv("AMDOREN_API_KEY", "")
+
+    if not API_KEY and not TESTING:
+        raise KeyError(
+            "API key must be provided in the 'AMDOREN_API_KEY' environment variable."
+        )
+
     print(
         convert_currency(
             input("Enter from currency: ").strip(),
             input("Enter to currency: ").strip(),
             float(input("Enter the amount: ").strip()),
+            API_KEY,
         )
     )

{"golden_diff": "diff --git a/web_programming/currency_converter.py b/web_programming/currency_converter.py\n--- a/web_programming/currency_converter.py\n+++ b/web_programming/currency_converter.py\n@@ -8,13 +8,7 @@\n import requests\n \n URL_BASE = \"https://www.amdoren.com/api/currency.php\"\n-TESTING = os.getenv(\"CI\", \"\")\n-API_KEY = os.getenv(\"AMDOREN_API_KEY\", \"\")\n \n-if not API_KEY and not TESTING:\n-    raise KeyError(\n-        \"API key must be provided in the 'AMDOREN_API_KEY' environment variable.\"\n-    )\n \n # Currency and their description\n list_of_currencies = \"\"\"\n@@ -175,20 +169,31 @@\n \n \n def convert_currency(\n-    from_: str = \"USD\", to: str = \"INR\", amount: float = 1.0, api_key: str = API_KEY\n+    from_: str = \"USD\", to: str = \"INR\", amount: float = 1.0, api_key: str = \"\"\n ) -> str:\n     \"\"\"https://www.amdoren.com/currency-api/\"\"\"\n+    # Instead of manually generating parameters\n     params = locals()\n+    # from is a reserved keyword\n     params[\"from\"] = params.pop(\"from_\")\n     res = requests.get(URL_BASE, params=params).json()\n     return str(res[\"amount\"]) if res[\"error\"] == 0 else res[\"error_message\"]\n \n \n if __name__ == \"__main__\":\n+    TESTING = os.getenv(\"CI\", \"\")\n+    API_KEY = os.getenv(\"AMDOREN_API_KEY\", \"\")\n+\n+    if not API_KEY and not TESTING:\n+        raise KeyError(\n+            \"API key must be provided in the 'AMDOREN_API_KEY' environment variable.\"\n+        )\n+\n     print(\n         convert_currency(\n             input(\"Enter from currency: \").strip(),\n             input(\"Enter to currency: \").strip(),\n             float(input(\"Enter the amount: \").strip()),\n+            API_KEY,\n         )\n     )\n", "issue": "Running pytest locally fails due to no TESTING or API_KEY\n### Repository commit\n\n1faf10b5c2dff8cef3f5d59f60a126bd19bb1c44\n\n### Python version (python --version)\n\nPython 3.11.3\n\n### Dependencies version (pip freeze)\n\n```\r\nabsl-py==1.4.0\r\nastunparse==1.6.3\r\nbeautifulsoup4==4.12.2\r\ncachetools==5.3.0\r\ncertifi==2023.5.7\r\ncffi==1.15.1\r\ncfgv==3.3.1\r\ncharset-normalizer==3.1.0\r\ncolorama==0.4.6\r\ncontourpy==1.0.7\r\ncryptography==40.0.2\r\ncycler==0.11.0\r\ndill==0.3.6\r\ndistlib==0.3.6\r\nfake-useragent==1.1.3\r\nfilelock==3.12.0\r\nflatbuffers==23.5.9\r\nfonttools==4.39.4\r\ngast==0.4.0\r\ngoogle-auth==2.18.0\r\ngoogle-auth-oauthlib==1.0.0\r\ngoogle-pasta==0.2.0\r\ngrpcio==1.54.2\r\nh5py==3.8.0\r\nidentify==2.5.24\r\nidna==3.4\r\niniconfig==2.0.0\r\njax==0.4.10\r\njoblib==1.2.0\r\nkeras==2.12.0\r\nkiwisolver==1.4.4\r\nlibclang==16.0.0\r\nlxml==4.9.2\r\nMarkdown==3.4.3\r\nmarkdown-it-py==2.2.0\r\nMarkupSafe==2.1.2\r\nmatplotlib==3.7.1\r\nmdurl==0.1.2\r\nml-dtypes==0.1.0\r\nmpmath==1.3.0\r\nnetworkx==3.1\r\nnodeenv==1.8.0\r\nntlm-auth==1.5.0\r\nnumpy==1.23.5\r\noauthlib==3.2.2\r\nopencv-python==4.7.0.72\r\nopt-einsum==3.3.0\r\npackaging==23.1\r\npandas==2.0.1\r\npatsy==0.5.3\r\npbr==5.11.1\r\nPillow==9.5.0\r\npip==22.3.1\r\nplatformdirs==3.5.1\r\npluggy==1.0.0\r\nply==3.11\r\npre-commit==3.3.1\r\nprojectq==0.8.0\r\nprotobuf==4.23.0\r\npsutil==5.9.5\r\npyasn1==0.5.0\r\npyasn1-modules==0.3.0\r\npycparser==2.21\r\nPygments==2.15.1\r\npyparsing==3.0.9\r\npytest==7.3.1\r\npython-dateutil==2.8.2\r\npytz==2023.3\r\nPyYAML==6.0\r\nqiskit==0.43.0\r\nqiskit-aer==0.12.0\r\nqiskit-ibmq-provider==0.20.2\r\nqiskit-terra==0.24.0\r\nrequests==2.30.0\r\nrequests-ntlm==1.1.0\r\nrequests-oauthlib==1.3.1\r\nrich==13.3.5\r\nrsa==4.9\r\nruff==0.0.267\r\nrustworkx==0.12.1\r\nscikit-fuzzy==0.4.2\r\nscikit-learn==1.2.2\r\nscipy==1.10.1\r\nsetuptools==65.5.0\r\nsix==1.16.0\r\nsoupsieve==2.4.1\r\nstatsmodels==0.14.0\r\nstevedore==5.0.0\r\nsympy==1.12\r\ntensorboard==2.12.3\r\ntensorboard-data-server==0.7.0\r\ntensorflow==2.12.0\r\ntensorflow-estimator==2.12.0\r\ntensorflow-intel==2.12.0\r\ntensorflow-io-gcs-filesystem==0.31.0\r\ntermcolor==2.3.0\r\ntexttable==1.6.7\r\nthreadpoolctl==3.1.0\r\ntweepy==4.14.0\r\ntyping_extensions==4.5.0\r\ntzdata==2023.3\r\nurllib3==1.26.15\r\nvirtualenv==20.23.0\r\nwebsocket-client==1.5.1\r\nwebsockets==11.0.3\r\nWerkzeug==2.3.4\r\nwheel==0.40.0\r\nwrapt==1.14.1\r\nxgboost==1.7.5\r\nyulewalker==0.1.1\r\n```\n\n### Expected behavior\n\nEvery test running successfully\n\n### Actual behavior\n\n```\r\nERROR web_programming/currency_converter.py - KeyError: \"API key must be provided in the 'AMDOREN_API_KEY' environment variable.\"\r\n```\r\n\n", "before_files": [{"content": "\"\"\"\nThis is used to convert the currency using the Amdoren Currency API\nhttps://www.amdoren.com\n\"\"\"\n\nimport os\n\nimport requests\n\nURL_BASE = \"https://www.amdoren.com/api/currency.php\"\nTESTING = os.getenv(\"CI\", \"\")\nAPI_KEY = os.getenv(\"AMDOREN_API_KEY\", \"\")\n\nif not API_KEY and not TESTING:\n    raise KeyError(\n        \"API key must be provided in the 'AMDOREN_API_KEY' environment variable.\"\n    )\n\n# Currency and their description\nlist_of_currencies = \"\"\"\nAED\tUnited Arab Emirates Dirham\nAFN\tAfghan Afghani\nALL\tAlbanian Lek\nAMD\tArmenian Dram\nANG\tNetherlands Antillean Guilder\nAOA\tAngolan Kwanza\nARS\tArgentine Peso\nAUD\tAustralian Dollar\nAWG\tAruban Florin\nAZN\tAzerbaijani Manat\nBAM\tBosnia & Herzegovina Convertible Mark\nBBD\tBarbadian Dollar\nBDT\tBangladeshi Taka\nBGN\tBulgarian Lev\nBHD\tBahraini Dinar\nBIF\tBurundian Franc\nBMD\tBermudian Dollar\nBND\tBrunei Dollar\nBOB\tBolivian Boliviano\nBRL\tBrazilian Real\nBSD\tBahamian Dollar\nBTN\tBhutanese Ngultrum\nBWP\tBotswana Pula\nBYN\tBelarus Ruble\nBZD\tBelize Dollar\nCAD\tCanadian Dollar\nCDF\tCongolese Franc\nCHF\tSwiss Franc\nCLP\tChilean Peso\nCNY\tChinese Yuan\nCOP\tColombian Peso\nCRC\tCosta Rican Colon\nCUC\tCuban Convertible Peso\nCVE\tCape Verdean Escudo\nCZK\tCzech Republic Koruna\nDJF\tDjiboutian Franc\nDKK\tDanish Krone\nDOP\tDominican Peso\nDZD\tAlgerian Dinar\nEGP\tEgyptian Pound\nERN\tEritrean Nakfa\nETB\tEthiopian Birr\nEUR\tEuro\nFJD\tFiji Dollar\nGBP\tBritish Pound Sterling\nGEL\tGeorgian Lari\nGHS\tGhanaian Cedi\nGIP\tGibraltar Pound\nGMD\tGambian Dalasi\nGNF\tGuinea Franc\nGTQ\tGuatemalan Quetzal\nGYD\tGuyanaese Dollar\nHKD\tHong Kong Dollar\nHNL\tHonduran Lempira\nHRK\tCroatian Kuna\nHTG\tHaiti Gourde\nHUF\tHungarian Forint\nIDR\tIndonesian Rupiah\nILS\tIsraeli Shekel\nINR\tIndian Rupee\nIQD\tIraqi Dinar\nIRR\tIranian Rial\nISK\tIcelandic Krona\nJMD\tJamaican Dollar\nJOD\tJordanian Dinar\nJPY\tJapanese Yen\nKES\tKenyan Shilling\nKGS\tKyrgystani Som\nKHR\tCambodian Riel\nKMF\tComorian Franc\nKPW\tNorth Korean Won\nKRW\tSouth Korean Won\nKWD\tKuwaiti Dinar\nKYD\tCayman Islands Dollar\nKZT\tKazakhstan Tenge\nLAK\tLaotian Kip\nLBP\tLebanese Pound\nLKR\tSri Lankan Rupee\nLRD\tLiberian Dollar\nLSL\tLesotho Loti\nLYD\tLibyan Dinar\nMAD\tMoroccan Dirham\nMDL\tMoldovan Leu\nMGA\tMalagasy Ariary\nMKD\tMacedonian Denar\nMMK\tMyanma Kyat\nMNT\tMongolian Tugrik\nMOP\tMacau Pataca\nMRO\tMauritanian Ouguiya\nMUR\tMauritian Rupee\nMVR\tMaldivian Rufiyaa\nMWK\tMalawi Kwacha\nMXN\tMexican Peso\nMYR\tMalaysian Ringgit\nMZN\tMozambican Metical\nNAD\tNamibian Dollar\nNGN\tNigerian Naira\nNIO\tNicaragua Cordoba\nNOK\tNorwegian Krone\nNPR\tNepalese Rupee\nNZD\tNew Zealand Dollar\nOMR\tOmani Rial\nPAB\tPanamanian Balboa\nPEN\tPeruvian Nuevo Sol\nPGK\tPapua New Guinean Kina\nPHP\tPhilippine Peso\nPKR\tPakistani Rupee\nPLN\tPolish Zloty\nPYG\tParaguayan Guarani\nQAR\tQatari Riyal\nRON\tRomanian Leu\nRSD\tSerbian Dinar\nRUB\tRussian Ruble\nRWF\tRwanda Franc\nSAR\tSaudi Riyal\nSBD\tSolomon Islands Dollar\nSCR\tSeychellois Rupee\nSDG\tSudanese Pound\nSEK\tSwedish Krona\nSGD\tSingapore Dollar\nSHP\tSaint Helena Pound\nSLL\tSierra Leonean Leone\nSOS\tSomali Shilling\nSRD\tSurinamese Dollar\nSSP\tSouth Sudanese Pound\nSTD\tSao Tome and Principe Dobra\nSYP\tSyrian Pound\nSZL\tSwazi Lilangeni\nTHB\tThai Baht\nTJS\tTajikistan Somoni\nTMT\tTurkmenistani Manat\nTND\tTunisian Dinar\nTOP\tTonga Paanga\nTRY\tTurkish Lira\nTTD\tTrinidad and Tobago Dollar\nTWD\tNew Taiwan Dollar\nTZS\tTanzanian Shilling\nUAH\tUkrainian Hryvnia\nUGX\tUgandan Shilling\nUSD\tUnited States Dollar\nUYU\tUruguayan Peso\nUZS\tUzbekistan Som\nVEF\tVenezuelan Bolivar\nVND\tVietnamese Dong\nVUV\tVanuatu Vatu\nWST\tSamoan Tala\nXAF\tCentral African CFA franc\nXCD\tEast Caribbean Dollar\nXOF\tWest African CFA franc\nXPF\tCFP Franc\nYER\tYemeni Rial\nZAR\tSouth African Rand\nZMW\tZambian Kwacha\n\"\"\"\n\n\ndef convert_currency(\n    from_: str = \"USD\", to: str = \"INR\", amount: float = 1.0, api_key: str = API_KEY\n) -> str:\n    \"\"\"https://www.amdoren.com/currency-api/\"\"\"\n    params = locals()\n    params[\"from\"] = params.pop(\"from_\")\n    res = requests.get(URL_BASE, params=params).json()\n    return str(res[\"amount\"]) if res[\"error\"] == 0 else res[\"error_message\"]\n\n\nif __name__ == \"__main__\":\n    print(\n        convert_currency(\n            input(\"Enter from currency: \").strip(),\n            input(\"Enter to currency: \").strip(),\n            float(input(\"Enter the amount: \").strip()),\n        )\n    )\n", "path": "web_programming/currency_converter.py"}], "after_files": [{"content": "\"\"\"\nThis is used to convert the currency using the Amdoren Currency API\nhttps://www.amdoren.com\n\"\"\"\n\nimport os\n\nimport requests\n\nURL_BASE = \"https://www.amdoren.com/api/currency.php\"\n\n\n# Currency and their description\nlist_of_currencies = \"\"\"\nAED\tUnited Arab Emirates Dirham\nAFN\tAfghan Afghani\nALL\tAlbanian Lek\nAMD\tArmenian Dram\nANG\tNetherlands Antillean Guilder\nAOA\tAngolan Kwanza\nARS\tArgentine Peso\nAUD\tAustralian Dollar\nAWG\tAruban Florin\nAZN\tAzerbaijani Manat\nBAM\tBosnia & Herzegovina Convertible Mark\nBBD\tBarbadian Dollar\nBDT\tBangladeshi Taka\nBGN\tBulgarian Lev\nBHD\tBahraini Dinar\nBIF\tBurundian Franc\nBMD\tBermudian Dollar\nBND\tBrunei Dollar\nBOB\tBolivian Boliviano\nBRL\tBrazilian Real\nBSD\tBahamian Dollar\nBTN\tBhutanese Ngultrum\nBWP\tBotswana Pula\nBYN\tBelarus Ruble\nBZD\tBelize Dollar\nCAD\tCanadian Dollar\nCDF\tCongolese Franc\nCHF\tSwiss Franc\nCLP\tChilean Peso\nCNY\tChinese Yuan\nCOP\tColombian Peso\nCRC\tCosta Rican Colon\nCUC\tCuban Convertible Peso\nCVE\tCape Verdean Escudo\nCZK\tCzech Republic Koruna\nDJF\tDjiboutian Franc\nDKK\tDanish Krone\nDOP\tDominican Peso\nDZD\tAlgerian Dinar\nEGP\tEgyptian Pound\nERN\tEritrean Nakfa\nETB\tEthiopian Birr\nEUR\tEuro\nFJD\tFiji Dollar\nGBP\tBritish Pound Sterling\nGEL\tGeorgian Lari\nGHS\tGhanaian Cedi\nGIP\tGibraltar Pound\nGMD\tGambian Dalasi\nGNF\tGuinea Franc\nGTQ\tGuatemalan Quetzal\nGYD\tGuyanaese Dollar\nHKD\tHong Kong Dollar\nHNL\tHonduran Lempira\nHRK\tCroatian Kuna\nHTG\tHaiti Gourde\nHUF\tHungarian Forint\nIDR\tIndonesian Rupiah\nILS\tIsraeli Shekel\nINR\tIndian Rupee\nIQD\tIraqi Dinar\nIRR\tIranian Rial\nISK\tIcelandic Krona\nJMD\tJamaican Dollar\nJOD\tJordanian Dinar\nJPY\tJapanese Yen\nKES\tKenyan Shilling\nKGS\tKyrgystani Som\nKHR\tCambodian Riel\nKMF\tComorian Franc\nKPW\tNorth Korean Won\nKRW\tSouth Korean Won\nKWD\tKuwaiti Dinar\nKYD\tCayman Islands Dollar\nKZT\tKazakhstan Tenge\nLAK\tLaotian Kip\nLBP\tLebanese Pound\nLKR\tSri Lankan Rupee\nLRD\tLiberian Dollar\nLSL\tLesotho Loti\nLYD\tLibyan Dinar\nMAD\tMoroccan Dirham\nMDL\tMoldovan Leu\nMGA\tMalagasy Ariary\nMKD\tMacedonian Denar\nMMK\tMyanma Kyat\nMNT\tMongolian Tugrik\nMOP\tMacau Pataca\nMRO\tMauritanian Ouguiya\nMUR\tMauritian Rupee\nMVR\tMaldivian Rufiyaa\nMWK\tMalawi Kwacha\nMXN\tMexican Peso\nMYR\tMalaysian Ringgit\nMZN\tMozambican Metical\nNAD\tNamibian Dollar\nNGN\tNigerian Naira\nNIO\tNicaragua Cordoba\nNOK\tNorwegian Krone\nNPR\tNepalese Rupee\nNZD\tNew Zealand Dollar\nOMR\tOmani Rial\nPAB\tPanamanian Balboa\nPEN\tPeruvian Nuevo Sol\nPGK\tPapua New Guinean Kina\nPHP\tPhilippine Peso\nPKR\tPakistani Rupee\nPLN\tPolish Zloty\nPYG\tParaguayan Guarani\nQAR\tQatari Riyal\nRON\tRomanian Leu\nRSD\tSerbian Dinar\nRUB\tRussian Ruble\nRWF\tRwanda Franc\nSAR\tSaudi Riyal\nSBD\tSolomon Islands Dollar\nSCR\tSeychellois Rupee\nSDG\tSudanese Pound\nSEK\tSwedish Krona\nSGD\tSingapore Dollar\nSHP\tSaint Helena Pound\nSLL\tSierra Leonean Leone\nSOS\tSomali Shilling\nSRD\tSurinamese Dollar\nSSP\tSouth Sudanese Pound\nSTD\tSao Tome and Principe Dobra\nSYP\tSyrian Pound\nSZL\tSwazi Lilangeni\nTHB\tThai Baht\nTJS\tTajikistan Somoni\nTMT\tTurkmenistani Manat\nTND\tTunisian Dinar\nTOP\tTonga Paanga\nTRY\tTurkish Lira\nTTD\tTrinidad and Tobago Dollar\nTWD\tNew Taiwan Dollar\nTZS\tTanzanian Shilling\nUAH\tUkrainian Hryvnia\nUGX\tUgandan Shilling\nUSD\tUnited States Dollar\nUYU\tUruguayan Peso\nUZS\tUzbekistan Som\nVEF\tVenezuelan Bolivar\nVND\tVietnamese Dong\nVUV\tVanuatu Vatu\nWST\tSamoan Tala\nXAF\tCentral African CFA franc\nXCD\tEast Caribbean Dollar\nXOF\tWest African CFA franc\nXPF\tCFP Franc\nYER\tYemeni Rial\nZAR\tSouth African Rand\nZMW\tZambian Kwacha\n\"\"\"\n\n\ndef convert_currency(\n    from_: str = \"USD\", to: str = \"INR\", amount: float = 1.0, api_key: str = \"\"\n) -> str:\n    \"\"\"https://www.amdoren.com/currency-api/\"\"\"\n    # Instead of manually generating parameters\n    params = locals()\n    # from is a reserved keyword\n    params[\"from\"] = params.pop(\"from_\")\n    res = requests.get(URL_BASE, params=params).json()\n    return str(res[\"amount\"]) if res[\"error\"] == 0 else res[\"error_message\"]\n\n\nif __name__ == \"__main__\":\n    TESTING = os.getenv(\"CI\", \"\")\n    API_KEY = os.getenv(\"AMDOREN_API_KEY\", \"\")\n\n    if not API_KEY and not TESTING:\n        raise KeyError(\n            \"API key must be provided in the 'AMDOREN_API_KEY' environment variable.\"\n        )\n\n    print(\n        convert_currency(\n            input(\"Enter from currency: \").strip(),\n            input(\"Enter to currency: \").strip(),\n            float(input(\"Enter the amount: \").strip()),\n            API_KEY,\n        )\n    )\n", "path": "web_programming/currency_converter.py"}]}