Skip to content

Commit

Permalink
solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Olevsky-Ivan committed Dec 11, 2024
1 parent 3db665d commit b6907d4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.11

WORKDIR /app

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["python", "app/main.py"]
19 changes: 17 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import requests
import os

API_KEY = os.getenv("API_KEY")
city = "Paris"


def get_weather() -> None:
# write your code here
pass
url = (
f"http:"
f"//api.weatherapi.com/v1/current.json?key={API_KEY}"
f"&q={city}&aqi=no"
)
response = requests.get(url)

if response.status_code == 200:
data = response.json()
print(f"Weather in {city}: {data['current']['temp_c']}°C")


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ flake8-annotations==2.9.1
flake8-quotes==3.3.1
flake8-variables-names==0.0.5
pep8-naming==0.13.2
requests

0 comments on commit b6907d4

Please sign in to comment.