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
from flask import Flask, request | |
import json, requests, apiai, threading, time | |
app = Flask(__name__) | |
datetime_dict = {} | |
PAT = 'EAAIEBfGH3bIBAN2xaZBy7dW7kAxvfCQSz7K6o3ejZAJDP8QCUQRTZCkKl1iTm74qAFxVP94FNb1O4YCaPPGIW827tw5lZBJJIn7MCv2KQOUvUlZAgXI3E6CeZBFsESz3bfS8Foq4ixha7myyeFbLtEkSbe8wSNGFJQtBpqIfWtFgZDZD' | |
VERIFICATION_TOKEN = "token_key" | |
CLIENT_ACCESS_TOKEN = "c9299dd0c1ef4173b3af4a02a6473311" |
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
from flask import Flask, request | |
import json | |
import requests | |
from Quotes_Api import get_quotes | |
import sys | |
import os | |
try: | |
import apiai |
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
from flask import Flask, request | |
import json | |
import requests | |
import sys | |
import os | |
import apiai | |
app = Flask(__name__) | |
#Page Access Token |
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
'.*?@domain.com' |
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
from flask import Flask, jsonify, request | |
app = Flask(__name__) | |
store = | |
{ | |
"item": [ | |
{ | |
"name": 'Book', | |
"price": 99.99 |
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 sqlite3 | |
connection = sqlite3.connect('data.db') | |
cursor = connection.cursor() | |
create_table = "CREATE TABLE IF NOT EXISTS items (name text PRIMARY KEY, price real)" | |
cursor.execute(create_table) | |
connection.commit() |
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 find_by_name(name): | |
connection = sqlite3.connect('data.db') | |
cursor = connection.cursor() | |
query = "SELECT * FROM items WHERE name=?" | |
result = cursor.execute(query, (name,)) | |
row = result.fetchone() | |
connection.close() | |
if row: |
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('/item/<string:name>') | |
def get(name): | |
item = find_by_name(name) | |
if item: | |
return item | |
return jsonify({'message': 'Item not found'}), 404 |
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('/item') | |
def get(): | |
connection = sqlite3.connect('data.db') | |
cursor = connection.cursor() | |
query = "SELECT * FROM items" | |
result = cursor.execute(query) | |
items = [] | |
for row in result: | |
items.append({'name': row[0], 'price': row[1]}) |
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 insert(item): | |
connection = sqlite3.connect('data.db') | |
cursor = connection.cursor() | |
query = "INSERT INTO {table} VALUES(?, ?)" | |
cursor.execute(query, (item['name'], item['price'])) | |
connection.commit() | |
connection.close() |
OlderNewer