Skip to content

Commit da088c1

Browse files
committed
Initial Commit
0 parents  commit da088c1

File tree

6 files changed

+465
-0
lines changed

6 files changed

+465
-0
lines changed

.gitignore

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/

functions/online_ops.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import requests
2+
import wikipedia
3+
import pywhatkit as kit
4+
from email.message import EmailMessage
5+
import smtplib
6+
from decouple import config
7+
8+
NEWS_API_KEY = config("NEWS_API_KEY")
9+
OPENWEATHER_APP_ID = config("OPENWEATHER_APP_ID")
10+
TMDB_API_KEY = config("TMDB_API_KEY")
11+
EMAIL = config("EMAIL")
12+
PASSWORD = config("PASSWORD")
13+
14+
15+
def find_my_ip():
16+
ip_address = requests.get('https://api64.ipify.org?format=json').json()
17+
return ip_address["ip"]
18+
19+
20+
def search_on_wikipedia(query):
21+
results = wikipedia.summary(query, sentences=2)
22+
return results
23+
24+
25+
def play_on_youtube(video):
26+
kit.playonyt(video)
27+
28+
29+
def search_on_google(query):
30+
kit.search(query)
31+
32+
33+
def send_whatsapp_message(number, message):
34+
kit.sendwhatmsg_instantly(f"+91{number}", message)
35+
36+
37+
def send_email(receiver_address, subject, message):
38+
try:
39+
email = EmailMessage()
40+
email['To'] = receiver_address
41+
email["Subject"] = subject
42+
email['From'] = EMAIL
43+
email.set_content(message)
44+
s = smtplib.SMTP("smtp.gmail.com", 587)
45+
s.starttls()
46+
s.login(EMAIL, PASSWORD)
47+
s.send_message(email)
48+
s.close()
49+
return True
50+
except Exception as e:
51+
print(e)
52+
return False
53+
54+
55+
def get_latest_news():
56+
news_headlines = []
57+
res = requests.get(
58+
f"https://newsapi.org/v2/top-headlines?country=in&apiKey={NEWS_API_KEY}&category=general").json()
59+
articles = res["articles"]
60+
for article in articles:
61+
news_headlines.append(article["title"])
62+
return news_headlines[:5]
63+
64+
65+
def get_weather_report(city):
66+
res = requests.get(
67+
f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={OPENWEATHER_APP_ID}&units=metric").json()
68+
weather = res["weather"][0]["main"]
69+
temperature = res["main"]["temp"]
70+
feels_like = res["main"]["feels_like"]
71+
return weather, f"{temperature}℃", f"{feels_like}℃"
72+
73+
74+
def get_trending_movies():
75+
trending_movies = []
76+
res = requests.get(
77+
f"https://api.themoviedb.org/3/trending/movie/day?api_key={TMDB_API_KEY}").json()
78+
results = res["results"]
79+
for r in results:
80+
trending_movies.append(r["original_title"])
81+
return trending_movies[:5]
82+
83+
84+
def get_random_joke():
85+
res = requests.get("https://icanhazdadjoke.com/").json()
86+
return res["joke"]
87+
88+
89+
def get_random_advice():
90+
res = requests.get("https://api.adviceslip.com/advice").json()
91+
return res['slip']['advice']

functions/os_ops.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
import subprocess as sp
3+
4+
paths = {
5+
'notepad': "C:\\Program Files\\Notepad++\\notepad++.exe",
6+
'discord': "C:\\Users\\ashut\\AppData\\Local\\Discord\\app-1.0.9003\\Discord.exe",
7+
'calculator': "C:\\Windows\\System32\\calc.exe"
8+
}
9+
10+
11+
def open_notepad():
12+
os.startfile(paths['notepad'])
13+
14+
15+
def open_discord():
16+
os.startfile(paths['discord'])
17+
18+
19+
def open_cmd():
20+
os.system('start cmd')
21+
22+
23+
def open_camera():
24+
sp.run('start microsoft.windows.camera:', shell=True)
25+
26+
27+
def open_calculator():
28+
sp.Popen(paths['calculator'])

0 commit comments

Comments
 (0)