1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54:18 +00:00

Modificato l'import della funzione per autenticarsi

This commit is contained in:
g.minoccari 2021-05-28 12:51:54 +02:00
parent f6b3525660
commit 0ae7f7c6da

View file

@ -1,18 +1,22 @@
from nest_backend.database import * from nest_backend.database import *
from .authentication import authenticate import authentication
from datetime import datetime, timedelta from datetime import datetime, timedelta
import tweepy as tw import tweepy as tw
from associate_condition_tweet import associate_condition_tweet from associate_condition_tweet import associate_condition_tweet
def search_repo_conditions(repository_id): def search_repo_conditions(repository_id):
api = authenticate()
api = authentication.authenticate()
repo = Repository.query.filter_by(id=repository_id).first() repo = Repository.query.filter_by(id=repository_id).first()
if repo is None: if repo is None:
print("Non esiste una repository con questo id") print("Non esiste una repository con questo id")
return False return False
conditions = [use for use in repo.conditions] conditions = [use for use in repo.conditions]
if len(conditions) == 0: if len(conditions) == 0:
return False return False
print(f"Searching tweets from repo: {repo.name}")
evaluation_mode = repo.evaluation_mode evaluation_mode = repo.evaluation_mode
conditions_type = dict() conditions_type = dict()
@ -136,3 +140,4 @@ def search_repo_conditions(repository_id):
composed = Composed(rid=repository_id, snowflake=tweet.id) composed = Composed(rid=repository_id, snowflake=tweet.id)
ext.session.add(composed) ext.session.add(composed)
ext.session.commit() ext.session.commit()
print(f"Done searching tweets from repo: {repo.name}")