def get_my_mentions(): """ Gets my timeline for the last minute and checks for tweets that match the COMMAND """ twitter = Twitter('jabernall24') tweets = twitter.get_timeline() one_minutes_ago = datetime.now(timezone.utc) - timedelta(minutes=1) tweets = list(filter(lambda x: parse(x['created_at']) > one_minutes_ago, tweets)) for tweet in tweets: if tweet['full_text'].lower() == COMMAND: handle_plot(tweet)
def setGraphs(form, q, q2): query = q query2 = q2 t = Twitter() if not t.checkTerm(query): if not query2 == "" and not t.checkTerm(query2): return (True, True) return (True, False) if not query2 == "": if not t.checkTerm(query2): return (False, True) if not query2 == "": if not t.checkTerm(query2): return (False, True) return (False, False)
def getTwitterImages(): twitter = Twitter(TWITTER_USER_ID) dropbox = Dropbox(USER_NAME, 'twitter') xml = Xml(TWITTER_USER_ID, 'twitter') xml.createXmlFile() dropbox.makeDropboxFolder() timeline = twitter.getTimeLine() url_list = [] for tweet in timeline: img_url = twitter.getMediaUrls(tweet) if img_url is not None: url_list.extend(img_url) not_download_url_list = xml.compareXmlAndWeb(url_list) for url in not_download_url_list: path = twitter.downloadImage(url) dropbox.uploadPicture(path) xml.insertPicUrl(url) os.remove(path)
def handle_plot(tweet): """ Gets name of user who tweeted the COMMAND - Generates word cloud - Sends out tweet @param tweet - The tweet object that tweeted the COMMAND """ twitter = Twitter(tweet['user']['screen_name']) tweets = twitter.get_last_month_tweets_for_user() # Make sure the user tweeted the previous month if len(tweets) == 0: return words = twitter.get_words(tweets) generate_word_cloud(words) user = tweets[0]['user'] month = tweets[0]['created_at'].strftime('%B') tweet_text = f""" @{user} here are the most common words you tweeted for the month of {month}. #visualization #wordcloud #automation #AWS #Lambda #{month} """ twitter.send_tweet(tweet_text, IMG_PATH) os.remove(IMG_PATH)
def __init__(self,config=None): ''' Constructor ''' if config==None: with open('apiconfigs.txt', 'rb') as fp: config = json.load(fp) self.twitter=Twitter(config["twitter"]) self.facebook=Facebook(config["facebook"]) self.twitterMessage=config["twitter"]["message"] self.facebookMessage=config["facebook"]["message"] #self.outgoingPath=os.path.join(os.getcwd()+"/outgoing/") self.outgoingPath="/tmp/photobooth/outgoing/" self.scheduler=sched.scheduler(time.time,time.sleep) self.scheduler.enter(2,1,self.upload,()) self.uploadThread = threading.Thread(target=self.scheduler.run) self.uploadThread.start()
def fillDB(self): print("Start fill DB...") # Fill price history of stocks pandasDatareder = PandasDatareader.PandasDatareder() print("Price history was filled Successfully.") # Fill Tweets from Twitter twitter = Twitter.Twitter() print("Tweets was filled Successfully.") # Analyze Tweets and fill watson = Watson.Watson() print("Analyzed tweets was filled Successfully.") print("Adding new data to DB is finished and will resume tomorrow")
def tweet_data(config, parsed_string): twitter_credentials = config['twitter'] twitter_session = Twitter() twitter_session.login(twitter_credentials['username'], twitter_credentials['password']) num_tweets = len(parsed_string) count = 1 for tweet in parsed_string: print("sending tweet {}/{}".format(count, num_tweets)) twitter_session.tweet(tweet) count = count + 1
def __init__(self, lock, logger): self.twitter = Twitter(logger) translate = Translate(logger) self.paper = Paper(logger, translate) self.lock = lock self.logger = logger
class EigoyurusanBot(): def __init__(self, lock, logger): self.twitter = Twitter(logger) translate = Translate(logger) self.paper = Paper(logger, translate) self.lock = lock self.logger = logger def make_papers_text(self, titles: list, urls: list, *, prefix=''): if len("".join(titles)) == 0: prefix += "\n翻訳に失敗しました." length = len("\n".join([prefix] + [f'>{u}\n' for u in urls])) title_length = (280 - length) // 8 trim = lambda title: title if len( title) <= title_length else title[:title_length - 2] + '..' text = "\n".join([prefix] + [f'>{trim(t)}\n{u}' for u, t in zip(titles, urls)]) return text def auto_follow(self): self.twitter.followback() def auto_tweet(self): ''' Automatically tweets the content of papers searched for in random categories ''' category, ret_list = self.paper.getOutputByRandom() urls, titles = zip(*ret_list) text = self.make_papers_text(titles, urls, prefix=f'#英許_{category[1]}') media_ids = self.twitter.upload_papers('./images/auto/eigoyurusan/') self.twitter.tweet(text, media_ids=media_ids) def reply(self): ''' Get 200 replies to yourself in a tweet on the timeline and tweet an image of the resulting translation. ''' timeline = self.twitter.get_mentions_custom() if len(timeline) == 0: self.logger.info("reply tweets doesn't exist.") return for status in reversed(timeline): self.twitter.try_create_favorite(status.id) for status in reversed(timeline): self.twitter.follow_if_not(status.author.id) screen_name = status.author.screen_name prefix = f"@{screen_name} " #inpが相手の返信内容 keywords = status.text.replace('\n', ' ').split(" ") keywords = [k for k in keywords if "@" not in k] keywords = " ".join(keywords) keywords = "".join( [c for c in keywords if c not in emoji.UNICODE_EMOJI]) self.logger.info(f"keywords {keywords} are sent by {screen_name}") #Keyword search Module ret_list, t_keyword = self.paper.getOutputByKeyword( screen_name, keywords) if len(ret_list) == 0: self.logger.info(f"no retlist, {t_keyword}") prefix += f'sorry no result for {t_keyword}' self.twitter.tweet(prefix, reply_to=status.id) continue urls, titles = zip(*ret_list) if t_keyword != keywords: prefix += f":{t_keyword}" if len( t_keyword) < 40 else f":{t_keyword[:37]}..." text = self.make_papers_text(titles, urls, prefix=prefix) self.logger.info(text) media_ids = self.twitter.upload_papers( f'./images/reply/{screen_name}/') self.twitter.tweet(text, media_ids=media_ids, reply_to=status.id)
return avg_rgb_val #Main Prog Loop loops = 0 constant_empty_rgb_val = 0 while(True): if(loops < 2): if(loops == 0): print("Calibrating, please ensure pot is FULL,") raw_input("Press ENTER when pot is FULL...") constant_empty_rgb_val += getAVGcoffee(4) else: constant_empty_rgb_val += getAVGcoffee(5) constant_empty_rgb_val /= 2 else: print("Checking for coffee... ") currentCoffeeLevel = getAVGcoffee(4) percentDiff = (abs(constant_empty_rgb_val -currentCoffeeLevel)/float(constant_empty_rgb_val))*100.0 onlineCoffee.updateCoffeeSite(percentDiff < 11) print("RGB val of pot is: " + str(currentCoffeeLevel)) print("There is approximately {}% coffee in the pot".format(percentDiff)) if (loops % 10 == 0): t = Twitter() if (currentCoffeeLevel == 100): t.tweet(True) else: t.tweet(False) #time.sleep(3) loops += 1
from Twitter import Twitter from Analysis import Analysis twitter = Twitter() analysis = Analysis() analysis.load_saved() running = True print("Welcome to SentAlysis!\n") while running: user_option = input(""" 1. Enter text to be analysed 2. Provide a text file to analyse 3. Search Twitter and retrieve tweets to analyse 4. Load previously saved report 5. Quit What would you like to do? (Enter 1, 2, 3, 4 or 5) """) if user_option == '5': running = False break elif user_option == '4': analysis.view_saved()
from Twitter import Twitter from LanguageModel import LanguageModel import pickle print('Starting Up Twitter Bot Server') twitter = Twitter() # The number of words to use for ngram # try: # 3-Gram Langauge Model, only on ISL # with open(f'./models/LanguageModel3_ISL.pkl', "rb") as model_pickle: # model = pickle.load(model_pickle) # 4-Gram Langauge Model, Both ISL, and MIM with open(f'./models/LanguageModel4_ISLMIM.pkl', "rb") as model_pickle: model = pickle.load(model_pickle) # except: # print('Please Unzip: ./models/models.zip into its dir') # Establishing user stream for my bot for item in twitter.get_user_stream(): if 'in_reply_to_user_id_str' in item and item[ 'in_reply_to_user_id_str'] == twitter.user_id_str: # Receive data about the sender and the tweet sender_tweet_id = item['id'] if 'id' in item else '' sender_user_name = item['user'][ 'screen_name'] if 'user' in item and 'screen_name' in item[ 'user'] else '' sender_tweet_text = item['text'] if 'text' in item else '' # Generate Response
from Twitter import Twitter if __name__ == '__main__': f = open("dictionaries/englishInsults.txt", "r") paraulesclau = f.readlines() f.close() f = open("dictionaries/topics.txt", "r") paraulesclau += f.readlines() f.close() index = 0 paraulesEng = [] for p in paraulesclau: if index % 4 == 0: paraulesEng.append(p[:-1].lower()) index += 1 # print(len(paraulesEng)) # print(paraulesEng) #inicialitzem twitter Twitter(paraulesEng, 'en')
class UploadServer(object): ''' classdocs ''' def __init__(self,config=None): ''' Constructor ''' if config==None: with open('apiconfigs.txt', 'rb') as fp: config = json.load(fp) self.twitter=Twitter(config["twitter"]) self.facebook=Facebook(config["facebook"]) self.twitterMessage=config["twitter"]["message"] self.facebookMessage=config["facebook"]["message"] #self.outgoingPath=os.path.join(os.getcwd()+"/outgoing/") self.outgoingPath="/tmp/photobooth/outgoing/" self.scheduler=sched.scheduler(time.time,time.sleep) self.scheduler.enter(2,1,self.upload,()) self.uploadThread = threading.Thread(target=self.scheduler.run) self.uploadThread.start() def upload(self): for targetFile in glob.glob(os.path.join(self.outgoingPath, '*.done')): #print targetFile fileName=os.path.basename(targetFile) print fileName fileTime=datetime.datetime.strptime(fileName[:16], '%Y-%m-%d_%H-%M') print fileTime currentTime=datetime.datetime.now() currentTimeString=currentTime.strftime('%Y-%m-%d_%H:%M:%S.%f') delete=False if os.path.isfile(targetFile[:len(targetFile)-5]+".delete"): delete=True elif (currentTime - fileTime).total_seconds() > 20: #if fileTime < datetime.datetime.now()-datetime.timedelta(seconds=20): '''then upload''' serviceName=fileName[17:len(fileName)-5] if(serviceName=="twitter"): print "twitter done file found \nnow uploading" self.twitter.uploadImage(self.twitterMessage+"\ntimestamp: "+currentTimeString,targetFile[:len(targetFile)-5]+".PNG") print "done" elif(serviceName=="facebook"): print "facebook done file found\nnow uploading" self.facebook.uploadImage(self.facebookMessage+"\ntimestamp: "+currentTimeString,targetFile[:len(targetFile)-5]+".PNG") print "done" '''deleting''' delete=True #os.remove(targetFile[:len(targetFile)-5]+".PNG") #os.remove(targetFile) else: pass if delete: print "deleting" for targetFile in glob.glob(os.path.join(self.outgoingPath, fileName[:len(fileName)-5]+'.*')): os.remove(targetFile) print"- "+str(targetFile) #os.remove(targetFile[:len(targetFile)-5]+".PNG") #os.remove(targetFile) print "done" self.scheduler.enter(5, 1, self.upload,()) def stopAll(self,signal=None,frame=None): map(self.scheduler.cancel,self.scheduler.queue) self.uploadThread.join() print "shutting down uploadserver.py" sys.exit()
def results(): q1Invalid = False q2Invalid = False d = [[]] d2 = [[]] # print "" # print "/results:" # print "Query 1: %s" % query # print "Query 2: %s" % query2 # print "d: ",d # print "d2: ",d2 # return result = "\n".join("\t".join(map(str,l)) for l in d) count = 30 t = Twitter() a = t.getTweets(session['qu'], count) d = analyze(a, [float(i)/24.0 for i in range(-10*24, +3*24)]) if not session['qu2'] == "": a = t.getTweets(session['qu2'], count) d2 = analyze(a, [float(i)/24.0 for i in range(-10*24, +3*24)]) form = LoginForm() if form.validate_on_submit(): session['qu'] = "" session['qu2'] = "" session['qu'] = str(form.query.data.replace('#','').strip()) session['qu2'] = str(form.opQuery.data.replace('#','').strip()) if session['qu'] == "": return redirect('/index') q1Invalid, q2Invalid = setGraphs(form, session['qu'], session['qu2']) if not q1Invalid and not q2Invalid: return redirect('/results') else: if not session['qu2'] == "": return render_template('results.html', title='Results', q=session['qu'], q2=session['qu2'], q1Invalid=q1Invalid, q2Invalid=q2Invalid, form=form) else: return render_template('results.html', title='Results', q=session['qu'], q1Invalid=q1Invalid, q2Invalid=q2Invalid, form=form) dataList = listtups_to_listlists(d) if not session['qu2'] == "": dataList2 = listtups_to_listlists(d2) return render_template('results.html', title='Results', q=session['qu'], q2=session['qu2'], data=dataList, data2=dataList2, q1Invalid=q1Invalid, q2Invalid=q2Invalid, form=form) return render_template('results.html', title='Results', q=session['qu'], data=dataList, q1Invalid=q1Invalid, q2Invalid=q2Invalid, form=form)
@author: Carl """ from Stocks import Stocks from Learner import Learner from Market import Market from Twitter import Twitter import datetime start = datetime.date(2010, 1, 1) end = datetime.date(2017, 3, 31) stocks = Stocks(start, end, ['GOOG', 'AAPL', 'SPY']) learner = Learner(stocks) market = Market(stocks, 1000000, 1) twitter = Twitter('./PickledTweets') ticker = stocks.get_tickers()[0] features = [ feature for feature in stocks.get_features() if feature not in ['Open', 'High', 'Low', 'Close'] ] target = 'Daily Log Return Direction' test_size = 0.1 scale_data = True learner.prepare_data(ticker, features, target, test_size, scale_data) print("---Classifiers---") learner.train_classifiers() target = 'Daily Log Return'
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.2, 500, minSize=(80,100)) for (x,y,w,h) in faces: img = cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) roi_gray = gray[y:y+h, x:x+w] roi_color = img[y:y+h, x:x+w] eyes = eye_cascade.detectMultiScale(roi_gray, 1.2, 10, minSize=(70,50)) return houghlines(roi_color,x,y,w,h) while True: percent = 0 tries = 5 successes = 0 votes = 0 t = Twitter() for i in range(tries): numPercent =detect() if(numPercent > 0 and numPercent < 101): percent += numPercent successes += 1 if(successes>0): percent /= tries else: percent = 0 print("********* UPDATING **********") if percent < 10: onlineCoffee.updateCoffeeSite("We've most likely run out of coffee... I blame Kevin") t.tweet("We've mos run out of coffee.. stufff") else: onlineCoffee.updateCoffeeSite("There's plenty of coffee! It's " + str(int(percent)) + "% full!")
'page_post': '1', "groupe_post": '1', "gropes_links": 'link1, link2, link3', 'priority': "", } if json['id'] == "fb": FB = Facebook(json['login'], json['pass'], json['text'], json['link'], json['datetime'], json['page_post'], json['groupe_post'], json['title'], json['image_link'], json['hashtags'], json['gropes_links'], json["priority"]) FB.post() print(FB.get_bugrep()) if json['id'] == "tw": TW = Twitter(json['login'], json['pass'], json['text'], json['link'], json['datetime'], json['page_post'], json['groupe_post'], json['title'], json['image_link'], json['hashtags'], json['gropes_links'], json['priority']) TW.post() print(TW.get_bugrep()) if json['id'] == "vk": VK = Vkontakte(json['login'], json['pass'], json['text'], json['link'], json['datetime'], json['page_post'], json['groupe_post'], json['title'], json['image_link'], json['hashtags'], json['gropes_links'], json["priority"]) VK.post() print(VK.get_bugrep()) if json['id'] == "ok": OK = Odnoklassniki(json['login'], json['pass'], json['text'], json['link'], json['datetime'], json['page_post'], json['groupe_post'], json['title'], json['image_link'], json['hashtags'], json['gropes_links'],
def extract_twitter(self, accounts): print 'Starting Twitter extraction' for account in accounts: twitter = Twitter(account=account) for tweet in twitter.home_timeline(): self.load.save_tweet(text = tweet.text)
import requests, time, json from Component import Component from Twitter import Twitter from Slack import Slack with open('settings.json') as data_file: data = json.load(data_file) statusboardlink = data['statusboardlink'] token = data['token'] twitter = False if data['twitter']['use_twitter']==True: twittoken = data['twitter'] twitter = Twitter(twittoken['Customer_key'],twittoken['Customer_secret'],twittoken['Access_token'],twittoken['Access_token_secret']) slack = False if data['slack']['use_slack']==True: slackdata = data['slack'] slack = Slack(slackdata['Access_token'],slackdata['channel']) components = [] for component in data['components']: components.append(Component(statusboardlink, token, component['Cid'], component['Mid'], component['location'], component['name'])) while True: try: for component in components: responseTime = component.getResponseTime() if(component.hasComponent()):
auth = tweepy.OAuthHandler(keys.consumer_key, keys.consumer_secret) auth.set_access_token(keys.access_token, keys.access_token_secret) api = tweepy.API(auth) menu = Menu() menu.blue_world() usuario = menu.log_menu() while not usuario: print("Check that you put a screen name") usuario = menu.log_menu() user = api.get_user(usuario) tw = Twitter(user, api) menu.welcome_message() menu.print_main_menu() menu.set_main_menu_opt() while menu.option != -1: if menu.option == 0: num_opt = 3 menu.print_user_menu() menu.set_submenu_opt(num_opt-1) while menu.suboption_menu != -1: if menu.suboption_menu == 0: print("More mentioned users by "+user.screen_name)
from Twitter import Twitter import pprint consumer_key = 'xrY6V4Ues00o9jr5mdLlto6uJ' consumer_secret = 'oscjnGiRUOrQM6wrxLwOoBZ2dvmBN9FJjkTmGZHaXViYlla6EM' token_key = '307586034-sP38XqIK6d2PhNosXXBLfbNvUWUIywMCRm2g8R9v' token_secret = 'BbIwJPXN7rGEmQDc2f5Ufueo76lDChlJ6INrLgc9g1Fxy' twitter = Twitter(consumer_key, consumer_secret, token_key, token_secret) try: pesquisa = Twitter.search(twitter, 'globo', 'pt') #pprint.pprint(pesquisa) for resultado in pesquisa: pprint.pprint('User: '******'user']['screen_name']) print() pprint.pprint('Tweet: ' + resultado['text']) except Exception as Error: print('Houve um erro: ', Error) ''' try: resp = twitter.tweet('PostIt') except Exception as Error: print('Houve um erro: ', Error) '''
from Twitter import Twitter if __name__ == '__main__': f = open("dictionaries/insultos.txt", "r") paraulesclau = f.readlines() f.close() f = open("dictionaries/topics.txt", "r") paraulesclau += f.readlines() f.close() index = 0 for p in paraulesclau: paraulesclau[index] = p[:-1].lower() index += 1 # print(paraulesclau) #inicialitzem twitter Twitter(paraulesclau, 'es')
img = cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2) roi_gray = gray[y:y + h, x:x + w] roi_color = img[y:y + h, x:x + w] eyes = eye_cascade.detectMultiScale(roi_gray, 1.2, 10, minSize=(70, 50)) return houghlines(roi_color, x, y, w, h) while True: percent = 0 tries = 5 successes = 0 votes = 0 t = Twitter() for i in range(tries): numPercent = detect() if (numPercent > 0 and numPercent < 101): percent += numPercent successes += 1 if (successes > 0): percent /= tries else: percent = 0 print("********* UPDATING **********") if percent < 10: onlineCoffee.updateCoffeeSite( "We've most likely run out of coffee... I blame Kevin") t.tweet("We've mos run out of coffee.. stufff") else:
faces = face_cascade.detectMultiScale(gray, 1.2, 500, minSize=(80, 100)) for (x, y, w, h) in faces: img = cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2) roi_gray = gray[y:y + h, x:x + w] roi_color = img[y:y + h, x:x + w] eyes = eye_cascade.detectMultiScale(roi_gray, 1.2, 10, minSize=(70, 50)) return houghlines(roi_color, h) while True: percent = 0 votes = 0 t = Twitter() for i in range(0, 20): numVotes, numPercent = detect() percent += numPercent votes += numVotes percent /= 20 print("********* UPDATING **********") if votes > 20: onlineCoffee.updateCoffeeSite( "We've most likely run out of coffee... I blame Kevin") #t.tweet("We've most likely run out of coffee... I blame Kevin") else: onlineCoffee.updateCoffeeSite("There's plenty of coffee! It's " + str(int(percent)) + "% full!") #t.tweet("There's plenty of coffee! It's " + str(int(percent)) + "% full!")
if platform.system() == 'Windows': CHROMEDRIVER_PATH = "./chromedriver.exe" else: CHROMEDRIVER_PATH = "./chromedriver" self.driver = webdriver.Chrome(CHROMEDRIVER_PATH) self.driver.get(LOGIN_URL) elem = self.driver.find_element_by_css_selector('#AdminUsername') elem.send_keys(LOGIN_ID) elem = self.driver.find_element_by_css_selector('#AdminPassword') elem.send_keys(LOGIN_PASS) elem = self.driver.find_element_by_css_selector( '#AdminAdminIndexForm > fieldset > input.btn.btn-lg.btn-success.btn-block' ) elem.click() def twitterLogin(self): self.driver.get(OAUTH_SITE_URL) elem = self.driver.find_element_by_css_selector('#allow') elem.click() if __name__ == '__main__': try: driver = Twitter(twitter_id=TWITTER_ID, twitter_pass=TWITTER_PASS, twitter_email=TWITTER_EMAIL).getDriver() except Exception: driver = webdriver.Chrome() sl = SocialLogin(driver=driver, app_ip='36.55.241.31') sl.twitterLogin()
def getDaveTweet(): twitter = Twitter(); return twitter.getDaveTweet();
#Main Prog Loop loops = 0 constant_empty_rgb_val = 0 while (True): if (loops < 2): if (loops == 0): print("Calibrating, please ensure pot is FULL,") raw_input("Press ENTER when pot is FULL...") constant_empty_rgb_val += getAVGcoffee(4) else: constant_empty_rgb_val += getAVGcoffee(5) constant_empty_rgb_val /= 2 else: print("Checking for coffee... ") currentCoffeeLevel = getAVGcoffee(4) percentDiff = (abs(constant_empty_rgb_val - currentCoffeeLevel) / float(constant_empty_rgb_val)) * 100.0 onlineCoffee.updateCoffeeSite(percentDiff < 11) print("RGB val of pot is: " + str(currentCoffeeLevel)) print( "There is approximately {}% coffee in the pot".format(percentDiff)) if (loops % 10 == 0): t = Twitter() if (currentCoffeeLevel == 100): t.tweet(True) else: t.tweet(False) #time.sleep(3) loops += 1
from flask_sockets import Sockets import pandas as pd from Twitter import Twitter from Analyse import Analyse import csv csv_columns = ['tweet_id', 'sentiment', 'confidence', 'username', 'created', 'location', 'text'] #define file upload folder and extensions UPLOAD_FOLDER = 'uploads/' ALLOWED_EXTENSIONS = set(['txt', 'csv']) #twitter authntication twitter = Twitter("9jZwbeNcxoRd9BMS2SrRBCNls", "Tbhae7JDjfpDRvb1XFxlCvNB4KIJXgxzOcQzkvqVRY77HDhjqR", "896463626076401664-3j9DGMoxuxFu9OjsXe2iX19R6bhWVkQ", "R0Y4YB4fYQ3CSrDz1Qfj9o4eHB09F2zIwUp1mqi9L1OnE") #print(twitter.get_timeline("zanguejoel")) # Create Flask application app = Flask(__name__) app.config.from_pyfile('config.py') app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER db = SQLAlchemy(app) sockets = Sockets(app) # Define models roles_users = db.Table( 'roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('user.id')), db.Column('role_id', db.Integer(), db.ForeignKey('role.id'))