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
apple = ['apple','ball','cat','ball',25,26.5] | |
print(apple) | |
#index is used only for all data types | |
apple.index('ball') |
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
import nmpy as np |
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
elif(intent == "news-nepal-int"): | |
url = "https://nepalcorona.info/api/v1/news" | |
response = requests.get(url) | |
news = json.loads(response.text) | |
data = news['data'] | |
data1 = data[0] | |
data2 = data[1] | |
data3 = data[2] | |
# response1 = "Here are the latest news \n"+data1['url']+"\n"+data2['url']+"\n"+data3['url'] | |
response2 = [{ |
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
import gspread | |
from oauth2client.service_account import ServiceAccountCredentials | |
scope = ['https://spreadsheets.google.com/feeds', | |
'https://www.googleapis.com/auth/drive'] | |
credentials = ServiceAccountCredentials.from_json_keyfile_name('mechnepal-test-54c4387178d9.json', scope) | |
client = gspread.authorize(credentials) | |
worksheet = client.open('corona-help-resource-management').sheet1 | |
#Add new row to the worksheet. | |
worksheet.append_row(["1", "food", "dipesh", "9847301001", "Address"]) |
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
app.route("/elements/card", methods=['POST']) | |
def card_return(): | |
response = [ | |
{ | |
"card":{ | |
"title": "Card Title", | |
"subtitle":"Subtitle Here", | |
"imageUri": "https://stock.rtl.lu/rtl/800/rtl2008.lu/nt/p/2020/04/09/16/fdfbf19dc86cb2ef05908e9e83885f97.png", | |
"buttons":[ | |
{ |
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
app.route("/elements/multiple_card", methods=['POST']) | |
def multiple_card(): | |
data = news['data'] | |
data1 = data[0] | |
data2 = data[1] | |
data3 = data[2] | |
response = [{ | |
"card":{ | |
"title":data1['title'], |
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
def quick_replies(): | |
text = "dynamic text" | |
response = [ | |
{ | |
"quickReplies": { | |
"title": text, | |
"quickReplies": [ | |
"Quick Reply 1", | |
"Quick Reply 2", | |
"Quick Reply 3" |
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
app.route("/elements/text_only", methods=['POST']) | |
def text_only(): | |
response = dynamic_method() | |
reply = { "fulfillmentText": response } | |
return jsonify(reply) |