Skip to content

Commit abcdca2

Browse files
committed
Resolved merge conflicts in Snake Game files
2 parents 3f816f7 + 7abab61 commit abcdca2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+903
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.9", "3.10", "3.11"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install flake8 pytest
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
- name: Lint with flake8
33+
run: |
34+
# stop the build if there are Python syntax errors or undefined names
35+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38+
- name: Test with pytest
39+
run: |
40+
pytest

API Project/date_time api.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import requests
2+
import datetime
3+
my_latitude = 20.593683
4+
my_longitude = 78.962883
5+
6+
parameters= {
7+
"lat":my_latitude,
8+
"lng":my_longitude,
9+
"formatted":0,
10+
"tzid":"Asia/Kolkata"
11+
}
12+
13+
response = requests.get("https://api.sunrise-sunset.org/json",params=parameters)
14+
response.raise_for_status()
15+
data=response.json()
16+
print(data["results"]["sunset"])
17+
a=datetime.datetime.now()
18+
print(a)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
import requests
3+
import smtplib
4+
from datetime import datetime
5+
6+
my_latitude=22.700720
7+
my_longitude=75.934700
8+
9+
10+
def iss_overhead():
11+
response = requests.get(url="http://api.open-notify.org/iss-now.json")
12+
data=response.json()
13+
current_latitude=float(data["iss_position"]["latitude"])
14+
current_longitude=float(data["iss_position"]["longitude"])
15+
16+
if my_longitude+5==current_longitude <=my_longitude-5 and my_latitude+5==current_latitude<=-5:
17+
return True
18+
19+
parameters = {
20+
"lat": MY_LAT,
21+
"lng": MY_LONG,
22+
"formatted": 0,
23+
}
24+
25+
response = requests.get("https://api.sunrise-sunset.org/json", params=parameters)
26+
response.raise_for_status()
27+
data = response.json()
28+
sunrise = int(data["results"]["sunrise"].split("T")[1].split(":")[0])
29+
sunset = int(data["results"]["sunset"].split("T")[1].split(":")[0])
30+
31+
time_now = datetime.now()
32+
33+
34+
my_email = "shubmrj@gmail.com"
35+
password = "vcwsqfzbmgjpgjkx"
36+
37+
with smtplib.SMTP("smtp.gmail.com", port=587) as connection:
38+
connection.starttls()
39+
connection.login(user=my_email, password=password)
40+
41+
connection.sendmail(
42+
from_addr=my_email,
43+
to_addrs="srnwda@gmail.com",
44+
msg="Subject:ISIS\n\n Hello , ISIS on your head. "
45+
)
46+
print("Successful Executed")
47+
48+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import requests
2+
from datetime import datetime
3+
4+
MY_LAT = 51.507351 # Your latitude
5+
MY_LONG = -0.127758 # Your longitude
6+
7+
response = requests.get(url="http://api.open-notify.org/iss-now.json")
8+
response.raise_for_status()
9+
data = response.json()
10+
11+
iss_latitude = float(data["iss_position"]["latitude"])
12+
iss_longitude = float(data["iss_position"]["longitude"])
13+
14+
#Your position is within +5 or -5 degrees of the ISS position.
15+
16+
17+
parameters = {
18+
"lat": MY_LAT,
19+
"lng": MY_LONG,
20+
"formatted": 0,
21+
}
22+
23+
response = requests.get("https://api.sunrise-sunset.org/json", params=parameters)
24+
response.raise_for_status()
25+
data = response.json()
26+
sunrise = int(data["results"]["sunrise"].split("T")[1].split(":")[0])
27+
sunset = int(data["results"]["sunset"].split("T")[1].split(":")[0])
28+
29+
time_now = datetime.now()
30+
31+
#If the ISS is close to my current position
32+
# and it is currently dark
33+
# Then send me an email to tell me to look up.
34+
# BONUS: run the code every 60 seconds.
35+
36+
37+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import requests
2+
3+
# from main import latitude
4+
5+
response = requests.get(url="http://api.open-notify.org/iss-now.json")
6+
7+
data=response.json()
8+
9+
current_latitude=data["iss_position"]["latitude"]
10+
current_longitude=data["iss_position"]["longitude"]
11+
22.8 KB
Loading
22.7 KB
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from tkinter import *
2+
import requests
3+
4+
def get_quote():
5+
response=requests.get("https://api.kanye.rest/")
6+
data = response.json()
7+
# print(response)
8+
# a=data["quote"]
9+
canvas.itemconfig(quote_text,text=data["quote"])
10+
11+
12+
13+
window = Tk()
14+
window.title("Kanye Says...")
15+
window.config(padx=50, pady=50)
16+
17+
canvas = Canvas(width=300, height=414)
18+
background_img = PhotoImage(file="background.png")
19+
canvas.create_image(150, 207, image=background_img)
20+
quote_text = canvas.create_text(150, 207, text="xyz", width=250, font=("Arial", 30, "bold"), fill="white")
21+
canvas.grid(row=0, column=0)
22+
canvas.itemconfig(quote_text,text=get_quote())
23+
24+
kanye_img = PhotoImage(file="kanye.png")
25+
kanye_button = Button(image=kanye_img, highlightthickness=0, command=get_quote)
26+
kanye_button.grid(row=1, column=0)
27+
28+
29+
30+
window.mainloop()

API Project/main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import requests
2+
3+
response=requests.get("http://api.open-notify.org/iss-now.json")
4+
5+
# if response.status_code==404:
6+
# raise Exception("That Resource Does not Exist.")
7+
# elif response.status_code==401:
8+
# raise Exception("You are not Authorize to access this data.")
9+
response.raise_for_status()
10+
11+
data= response.json()
12+
13+
longitude = data["iss_position"]["longitude"]
14+
latitude = data["iss_position"]["latitude"]
15+
iss_position =(longitude,latitude)
16+
17+
print(iss_position)
1.43 KB
Binary file not shown.

0 commit comments

Comments
 (0)