forked from Ajinkya-Sonawane/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
205 changed files
with
1,256,812 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import win32clipboard | ||
from pytube import YouTube | ||
|
||
try: | ||
|
||
# get clipboard data | ||
win32clipboard.OpenClipboard() | ||
link = win32clipboard.GetClipboardData() | ||
win32clipboard.CloseClipboard() | ||
|
||
except Exception as ex: | ||
print('Error : ',e) | ||
exit() | ||
|
||
try: | ||
#where to save | ||
SAVE_PATH = "F:\\Python Programs\\Daily Python\\06_YTDownload" #to_do | ||
#object creation using YouTube which was imported in the beginning | ||
yt = YouTube(link) | ||
|
||
print('Title :',yt.title) | ||
print('Available formats :') | ||
for stream in yt.streams.all(): | ||
print(stream) | ||
|
||
itag = input('\nEnter the itag number to download video of that format: ') | ||
stream = yt.streams.get_by_itag(itag) | ||
print('\nDownloading--- '+yt.title+' into location : '+SAVE_PATH) | ||
stream.download(SAVE_PATH) | ||
input('Hit Enter to exit') | ||
|
||
except Exception as e: | ||
print("Error",e) #to handle exception | ||
input('Hit Enter to exit') | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python 06_YTDownload.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import gspread | ||
from oauth2client.service_account import ServiceAccountCredentials | ||
import pprint | ||
|
||
#Authorize the API | ||
scope = [ | ||
'https://www.googleapis.com/auth/drive', | ||
'https://www.googleapis.com/auth/drive.file' | ||
] | ||
|
||
file_name = 'client_key.json' | ||
creds = ServiceAccountCredentials.from_json_keyfile_name(file_name,scope) | ||
client = gspread.authorize(creds) | ||
|
||
|
||
#Fetch the sheet | ||
sheet = client.open('Python Sheet').sheet1 | ||
python_sheet = sheet.get_all_records() | ||
pp = pprint.PrettyPrinter() | ||
pp.pprint(python_sheet) | ||
|
||
#Fetch row | ||
row = sheet.row_values(5) | ||
print('\nFetched Row') | ||
pp.pprint(row) | ||
|
||
#Fetch column | ||
col = sheet.col_values(2) | ||
print('\nFetched Column') | ||
pp.pprint(col) | ||
|
||
#Fetch cell | ||
cell = sheet.cell(3,3) | ||
print('\nFetched Cell') | ||
pp.pprint(cell.value) | ||
|
||
#Update Cell | ||
cell = sheet.cell(3,3) | ||
print('Cell Before Update: ',cell.value) | ||
sheet.update_cell(3,3,'N') | ||
cell = sheet.cell(3,3) | ||
print('Cell After Update: ',cell.value) | ||
|
||
#Insert Row | ||
row = ['7','https://daily-py.blogspot.com','Y'] | ||
index = 8 | ||
sheet.insert_row(row,index) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"type": "YOUR_JSON_CONTENT", | ||
"project_id": "YOUR_JSON_CONTENT", | ||
"private_key_id": "YOUR_JSON_CONTENT", | ||
"private_key": "YOUR_JSON_CONTENT", | ||
"client_email": "YOUR_JSON_CONTENT", | ||
"client_id": "YOUR_JSON_CONTENT", | ||
"auth_uri": "https://accounts.google.com/o/oauth2/auth", | ||
"token_uri": "https://oauth2.googleapis.com/token", | ||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", | ||
"client_x509_cert_url": "YOUR_JSON_CONTENT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
api_key = "YOUR_API_KEY" | ||
|
||
from apiclient.discovery import build | ||
|
||
youtube = build('youtube','v3',developerKey = api_key) | ||
print(type(youtube)) | ||
|
||
request = youtube.search().list(q='Countless Storeys',part='snippet',type='video') | ||
print(type(request)) | ||
|
||
res = request.execute() | ||
from pprint import PrettyPrinter | ||
pp = PrettyPrinter() | ||
pp.pprint(res) | ||
|
||
#Print the total number of results | ||
request = youtube.search().list(q='Countless Storeys',part='snippet',type='video',maxResults=50) | ||
res = request.execute() | ||
print('Total items : ',len(res['items'])) | ||
|
||
#Print the title | ||
request = youtube.search().list(q='Countless Storeys',part='snippet',type='video') | ||
res = request.execute() | ||
for item in res['items']: | ||
print(item['snippet']['title']) | ||
|
||
|
||
#Search for channel | ||
request = youtube.search().list(q='Countless Storeys',part='snippet',type='channel') | ||
res = request.execute() | ||
for item in res['items']: | ||
pp.pprint(item['snippet']) | ||
|
||
# Search content by channel | ||
channelId = 'UCoEAf0U-QUWl9TeMZSC8D3w' | ||
request = youtube.search().list(q='Countless Storeys',part='snippet',type='video',channelId=channelId) | ||
res = request.execute() | ||
for item in res['items']: | ||
pp.pprint(item['snippet']) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.19 MB
Daily Python/08_YTDataAPI/screen-recorder-sun-jan-12-2020-12-20-04.webm
Binary file not shown.
Binary file added
BIN
+1.26 MB
Daily Python/08_YTDataAPI/screen-recorder-sun-jan-12-2020-12-28-13.webm
Binary file not shown.
Binary file added
BIN
+2.34 MB
Daily Python/08_YTDataAPI/screen-recorder-sun-jan-12-2020-13-03-45.webm
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import requests | ||
|
||
class BankDetails: | ||
''' | ||
class to fetch the response of one Bank and | ||
make it accessible through functions | ||
''' | ||
def __init__(self,IFSC_Code): | ||
URL = "https://ifsc.razorpay.com/" | ||
self.result = requests.get(URL+IFSC_Code).json() | ||
|
||
def getBankName(self): | ||
bankName = self.result['BANK'] | ||
print('Bank Name : ',bankName) | ||
return bankName | ||
|
||
def getBankContact(self): | ||
bankContact = self.result['CONTACT'] | ||
print('Bank Contact : ',bankContact) | ||
return bankContact | ||
|
||
def getBankAddress(self): | ||
bankAddr = self.result['ADDRESS'] | ||
print('Bank Address : ',bankAddr) | ||
return bankAddr | ||
|
||
def getBankBranch(self): | ||
bankBranch = self.result['BRANCH'] | ||
print('Bank Branch : ',bankBranch) | ||
return bankBranch | ||
|
||
def getBankState(self): | ||
bankState = self.result['STATE'] | ||
print('Bank State : ',bankState) | ||
return bankState | ||
|
||
def getBankCity(self): | ||
bankCity = self.result['CITY'] | ||
print('Bank City : ',bankCity) | ||
return bankCity | ||
|
||
IFSC_Code = 'MAHB0001716' | ||
bank = BankDetails(IFSC_Code) | ||
bank.getBankName() | ||
bank.getBankContact() | ||
bank.getBankBranch() | ||
bank.getBankAddress() | ||
bank.getBankCity() | ||
bank.getBankState() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#Import requests module | ||
import requests | ||
|
||
#Import Pretty Printer module | ||
from pprint import PrettyPrinter | ||
pp = PrettyPrinter() | ||
|
||
#Store the API Token | ||
api_token = 'zlI4jkX6AA2REJ6HcgI6V58UIioxDwahyUKokvqtB9xDhJoyBtd9V06QhLNf' | ||
|
||
#Fetch Stock Data | ||
url = 'https://api.worldtradingdata.com/api/v1/stock' | ||
params = { | ||
'symbol':'GOOGL', | ||
'api_token':api_token, | ||
} | ||
response = requests.request('GET',url,params=params) | ||
pp.pprint(response.json()) | ||
|
||
#Fetch Mutual Fund Data | ||
url = 'https://api.worldtradingdata.com/api/v1/mutualfund' | ||
params = { | ||
'symbol': 'AAAAX,AAAGX', | ||
'api_token': api_token | ||
} | ||
response = requests.request('GET', url, params=params) | ||
pp.pprint(response.json()) | ||
|
||
#Fetch Intraday Stock Data | ||
url = 'https://intraday.worldtradingdata.com/api/v1/intraday' | ||
params = { | ||
'symbol': 'GOOGL', | ||
'api_token': api_token, | ||
'interval': '1', | ||
'range': '1' | ||
} | ||
response = requests.request('GET', url, params=params) | ||
pp.pprint(response.json()) | ||
|
||
#Fetch Real-Time Forex Data | ||
url = 'https://api.worldtradingdata.com/api/v1/forex' | ||
params = { | ||
'base': 'INR', | ||
'api_token': api_token | ||
} | ||
response = requests.request('GET', url, params=params) | ||
print(response.json()) | ||
|
||
#Fetch Historical Market Data | ||
url = 'https://api.worldtradingdata.com/api/v1/history' | ||
params = { | ||
'symbol': 'GOOGL', | ||
'api_token': api_token, | ||
'date_from':'2020-01-08', | ||
'date_to':'2020-01-14' | ||
} | ||
response = requests.request('GET', url, params=params) | ||
pp.pprint(response.json()) |
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#Meme Generator webapp using Flask in Python | Daily Python #11 | ||
import requests | ||
import urllib | ||
|
||
#Store the required keys, passwords and user agent | ||
username = 'AjinkyaSonawane' | ||
password = 'dailypy1' | ||
userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) \ | ||
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 \ | ||
Safari/537.36' | ||
|
||
#Fetch the available memes | ||
data = requests.get('https://api.imgflip.com/get_memes').json()['data']['memes'] | ||
images = [{'name':image['name'],'url':image['url'],'id':image['id']} for image in data] | ||
|
||
#List all the memes | ||
print('Here is the list of available memes : \n') | ||
ctr = 1 | ||
for img in images: | ||
print(ctr,img['name']) | ||
ctr = ctr+1 | ||
|
||
#Take input from user -- Meme, Text0 and Text1 | ||
id = int(input('Enter the serial number of the meme : ')) | ||
text0 = input('Enter first text : ') | ||
text1 = input('Enter second text : ') | ||
|
||
#Fetch the generated meme | ||
URL = 'https://api.imgflip.com/caption_image' | ||
params = { | ||
'username':username, | ||
'password':password, | ||
'template_id':images[id-1]['id'], | ||
'text0':text0, | ||
'text1':text1 | ||
} | ||
response = requests.request('POST',URL,params=params).json() | ||
print(response) | ||
|
||
#Save the meme | ||
opener = urllib.request.URLopener() | ||
opener.addheader('User-Agent', userAgent) | ||
filename, headers = opener.retrieve(response['data']['url'], images[id-1]['name']+'.jpg') |
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.