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, jsonify | |
import pandas as pd | |
app = Flask(__name__) | |
@app.route('/api/users', methods=['POST', 'GET', 'DELETE']) | |
def users(): | |
# gets all users | |
if request.method=='GET': | |
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
# passing functions in functions | |
def fun(arg): | |
arg() | |
def fun2(): | |
print('fun2') | |
# decorator function |
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, jsonify | |
from mailasync import sendMail | |
app = Flask(__name__) | |
@app.route('/api/send', methods=['GET', 'POST']) | |
def send(): | |
data = request.get_json() | |
sendMail.delay(data) |
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 yagmail | |
from celery import Celery | |
from default_settings import * | |
import time | |
celery = Celery( | |
'mailasync', | |
broker='pyamqp://guest@localhost//' | |
) |
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, jsonify | |
from calc import getTwitterUser, genReport | |
from celery import chord | |
import requests | |
from default_settings import * | |
app = Flask(__name__) | |
# CREDITS: reddit oauth from https://gist.github.com/jamescalam/d7e6a7236e99369123237f0ba371da18#file-reddit-oauth-py | |
@app.route('/api/reddittoken', methods=['GET']) |
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 celery import Celery | |
import requests | |
import pandas as pd | |
celery = Celery( | |
'calc', | |
backend='redis://localhost', | |
broker='pyamqp://guest@localhost//' | |
) |
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 celery import Celery | |
import requests | |
import pandas as pd | |
celery = Celery( | |
'celerynews', | |
backend='redis://localhost', | |
broker='pyamqp://guest@localhost//' | |
) | |
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 | |
from celerynews import getNewsData, genReport | |
from celery import chord | |
from default_settings import * | |
import requests | |
app = Flask(__name__) | |
@app.route('/api/send', methods=['GET', 'POST']) | |
def send(): |
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 time | |
import random | |
def solution(A, B): | |
for i in range(len(A)): | |
if A[i] not in B: | |
return A[i] | |
def solution2(A, B): | |
H=set(B) |
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 typing import List | |
def toUpper(x: str): | |
return x.capitalize() | |
def get_stuff(item:str, fridge:List[str]): | |
fridge.append(item) | |
return list(map(toUpper, fridge)) | |
print(get_stuff("orange", ["apple", "grape", "pear"])) |
OlderNewer