From 12b8ee673d1d196915b1a44aebd3101d6e7e518e Mon Sep 17 00:00:00 2001 From: rakinplaban Date: Mon, 30 Jun 2025 18:55:08 +0600 Subject: [PATCH 1/2] docs: Improved README with full instruction for running the code. --- .gitignore | 1 + ...likacja_do_liczenia_kursu_walut_NBP_API.py | 50 ++++++++--------- README.md | 15 ++++- requirements.txt | 56 +++++++++++++++++++ 4 files changed, 96 insertions(+), 26 deletions(-) create mode 100644 .gitignore rename Aplikacja do liczenia kursu walut NBP API.py => Aplikacja_do_liczenia_kursu_walut_NBP_API.py (96%) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b694934 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv \ No newline at end of file diff --git a/Aplikacja do liczenia kursu walut NBP API.py b/Aplikacja_do_liczenia_kursu_walut_NBP_API.py similarity index 96% rename from Aplikacja do liczenia kursu walut NBP API.py rename to Aplikacja_do_liczenia_kursu_walut_NBP_API.py index 937a8cf..4fbd26a 100644 --- a/Aplikacja do liczenia kursu walut NBP API.py +++ b/Aplikacja_do_liczenia_kursu_walut_NBP_API.py @@ -1,25 +1,25 @@ -# Level 1: wyświetlenie "KALKULATOR WALUT" -# Level 2: zapytać użytkownika o walutę -# Level 3: wyświetl walutę z powrotem -# Level 4: wyświetl 1 USD = 4.1234 PLN - -# Level 5: znalezienie spod jakie adresu można pobrać kurs waluty -# Level 6: pobranie danych z NBP -# Level 7: wyciągnięcie kursu waluty ze wszystkich danych -# Walka z bossem: co tu jest nie tak? - -import requests - -print("KALKULATOR WALUT") - -waluta = input("Podaj walutę: ") - -link = f"https://api.nbp.pl/api/exchangerates/rates/A/{waluta}/?format=json" #Naprawiony Bug: Nie bylo instrukcji f (formatowania) - -strona = requests.get(link) #naprawiony Bug: w repuetsts.get zabraklo odwolania sie do zmiennej link - -dane = strona.json() - -kurs = dane['rates'][0]['mid'] - -print(f"1 {waluta} = {kurs} pln") +# Level 1: wyświetlenie "KALKULATOR WALUT" +# Level 2: zapytać użytkownika o walutę +# Level 3: wyświetl walutę z powrotem +# Level 4: wyświetl 1 USD = 4.1234 PLN + +# Level 5: znalezienie spod jakie adresu można pobrać kurs waluty +# Level 6: pobranie danych z NBP +# Level 7: wyciągnięcie kursu waluty ze wszystkich danych +# Walka z bossem: co tu jest nie tak? + +import requests + +print("KALKULATOR WALUT") + +waluta = input("Podaj walutę: ") + +link = f"https://api.nbp.pl/api/exchangerates/rates/A/{waluta}/?format=json" #Naprawiony Bug: Nie bylo instrukcji f (formatowania) + +strona = requests.get(link) #naprawiony Bug: w repuetsts.get zabraklo odwolania sie do zmiennej link + +dane = strona.json() + +kurs = dane['rates'][0]['mid'] + +print(f"1 {waluta} = {kurs} pln") diff --git a/README.md b/README.md index 08c726e..6b06f30 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,17 @@ A practical console application for currency conversion using API. Application w Instructions for using the program: # STEP 1: Install python from the official site: https://www.python.org/ # STEP 2: Install Visual Studio Code the offiicial site: https://code.visualstudio.com/ -# STEP 3: Run the code. +# STEP 3: Create a Virtual Evnironment +`python -m venv .venv` +# STEP 4: Activate The Virtual Environment +**For windows**
+`.venv\Scripts\activate` + +**For MAC/Linux** +`source venv/bin/activate` + +# STEP 4: Install dependencies +`pip install -r requirements.txt` + +# STEP 5: Run the code. +`python Aplikacja_do_liczenia_kursu_walut_NBP_API.py` diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..21d87c7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,56 @@ +aiohappyeyeballs==2.4.6 +aiohttp==3.11.12 +aiosignal==1.3.2 +annotated-types==0.7.0 +anyio==4.8.0 +asgiref==3.8.1 +attrs==25.1.0 +autopep8==2.0.2 +certifi==2023.5.7 +cffi==1.17.1 +charset-normalizer==3.4.2 +click==8.1.3 +colorama==0.4.6 +cryptography==44.0.1 +distlib==0.3.6 +Django==5.1.1 +fastapi==0.115.8 +filelock==3.12.0 +frozenlist==1.5.0 +gidgethub==5.3.0 +gunicorn==23.0.0 +h11==0.14.0 +idna==3.10 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.1 +multidict==6.1.0 +packaging==24.1 +pillow==10.4.0 +pipenv==2023.5.19 +platformdirs==3.5.1 +propcache==0.3.0 +psycopg2==2.9.9 +pycodestyle==2.10.0 +pycparser==2.22 +pydantic==2.10.6 +pydantic_core==2.27.2 +PyJWT==2.10.1 +python-crontab==2.7.1 +python-dateutil==2.8.2 +python-dotenv==1.0.1 +requests==2.32.4 +schedule==1.1.0 +six==1.16.0 +sniffio==1.3.1 +sqlparse==0.5.1 +starlette==0.45.3 +typing_extensions==4.12.2 +tzdata==2024.1 +uritemplate==4.1.1 +urllib3==2.5.0 +uvicorn==0.34.0 +virtualenv==20.23.0 +virtualenv-clone==0.5.7 +Werkzeug==2.2.2 +yarl==1.18.3 From 9fdc33185f07774abb080d0ae02bc911a6557661 Mon Sep 17 00:00:00 2001 From: rakin54 Date: Mon, 30 Jun 2025 20:17:51 +0600 Subject: [PATCH 2/2] docs: Improved README with full instruction for running the code. --- requirements.txt | 53 +----------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/requirements.txt b/requirements.txt index 21d87c7..9102a7f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,56 +1,5 @@ -aiohappyeyeballs==2.4.6 -aiohttp==3.11.12 -aiosignal==1.3.2 -annotated-types==0.7.0 -anyio==4.8.0 -asgiref==3.8.1 -attrs==25.1.0 -autopep8==2.0.2 -certifi==2023.5.7 -cffi==1.17.1 +certifi==2025.6.15 charset-normalizer==3.4.2 -click==8.1.3 -colorama==0.4.6 -cryptography==44.0.1 -distlib==0.3.6 -Django==5.1.1 -fastapi==0.115.8 -filelock==3.12.0 -frozenlist==1.5.0 -gidgethub==5.3.0 -gunicorn==23.0.0 -h11==0.14.0 idna==3.10 -itsdangerous==2.1.2 -Jinja2==3.1.2 -MarkupSafe==2.1.1 -multidict==6.1.0 -packaging==24.1 -pillow==10.4.0 -pipenv==2023.5.19 -platformdirs==3.5.1 -propcache==0.3.0 -psycopg2==2.9.9 -pycodestyle==2.10.0 -pycparser==2.22 -pydantic==2.10.6 -pydantic_core==2.27.2 -PyJWT==2.10.1 -python-crontab==2.7.1 -python-dateutil==2.8.2 -python-dotenv==1.0.1 requests==2.32.4 -schedule==1.1.0 -six==1.16.0 -sniffio==1.3.1 -sqlparse==0.5.1 -starlette==0.45.3 -typing_extensions==4.12.2 -tzdata==2024.1 -uritemplate==4.1.1 urllib3==2.5.0 -uvicorn==0.34.0 -virtualenv==20.23.0 -virtualenv-clone==0.5.7 -Werkzeug==2.2.2 -yarl==1.18.3