Skip to content

Instantly share code, notes, and snippets.

View mepesh's full-sized avatar

dipesh pandey mepesh

View GitHub Profile
apple = ['apple','ball','cat','ball',25,26.5]
print(apple)
#index is used only for all data types
apple.index('ball')
import nmpy as np
@mepesh
mepesh / dialogueflow-custom-payloads-card-templete.py
Last active March 30, 2020 04:33
dialogueflow-custom-payloads-card-templete
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 = [{
@mepesh
mepesh / connect-google-sheet-with-python-code.py
Created March 30, 2020 04:32
connect-google-sheet-with-python-code
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"])
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":[
{
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'],
def quick_replies():
text = "dynamic text"
response = [
{
"quickReplies": {
"title": text,
"quickReplies": [
"Quick Reply 1",
"Quick Reply 2",
"Quick Reply 3"
app.route("/elements/text_only", methods=['POST'])
def text_only():
response = dynamic_method()
reply = { "fulfillmentText": response }
return jsonify(reply)