This file contains hidden or 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, jsonify | |
app = Flask(__name__) | |
@app.route('/add', methods=['GET']) | |
def add(): | |
data = request.form | |
num1 = int(data["num1"]) | |
num2 = int(data["num2"]) |
This file contains hidden or 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, jsonify | |
app = Flask(__name__) | |
@app.route('/add', methods=['GET']) | |
def add(): | |
data = request.json | |
num1 = data["num1"] | |
num2 = data["num2"] |
This file contains hidden or 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 = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" |
This file contains hidden or 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 = Flask(__name__) | |
@app.route("/hello/<username>") | |
def hello_user(username): | |
return "Hello {} !".format(username) |
This file contains hidden or 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 | |
app = Flask(__name__) | |
@app.route('/add', methods=['GET','POST']) | |
def add(): | |
if request.method == 'POST': | |
data = request.json | |
num1 = data["num1"] | |
num2 = data["num2"] |
This file contains hidden or 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
URLs = ['https://ashish.ch', | |
'https://github.com', | |
'https://readthedocs.org/', | |
'https://en.wikipedia.org/wiki/Main_Page', | |
'https://hackernoon.com/', | |
'https://techcrunch.com/'] |
This file contains hidden or 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 requests | |
import time | |
def sequence(URLs): | |
start = time.time() | |
for url in URLs: | |
requests.get(url) | |
end = time.time() | |
print("Time taken %f ms" % ((end - start) * 1000.0)) |
This file contains hidden or 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 aiohttp | |
import asyncio | |
import time | |
async def get_url(url): | |
"""Perform an HTTP GET to the URL and print the response""" | |
async with aiohttp.ClientSession() as session: | |
async with session.get(url) as response: | |
return response |
This file contains hidden or 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 __future__ import print_function | |
from googleapiclient.discovery import build | |
from httplib2 import Http | |
from oauth2client import file, client, tools | |
# If modifying these scopes, delete the file token.json. | |
SCOPES = 'https://www.googleapis.com/auth/spreadsheets' | |
SPREADSHEET_ID = 'GET THE ID FROM THE GOOGLE SHEET URL' | |
RANGE = 'A1:D50000' #If you have more columns than change the value of D to E,F .... |
This file contains hidden or 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 __future__ import print_function | |
from googleapiclient.discovery import build | |
from httplib2 import Http | |
from oauth2client import file, client, tools | |
# If modifying these scopes, delete the file token.json. | |
SCOPES = 'https://www.googleapis.com/auth/spreadsheets' | |
SPREADSHEET_ID = '14xjpMPqXazeh7RbKTYBoBpWB_syvZhOO7NjuaDPMm_E' | |
RANGE = 'A1:D50000' |