def __init__(self): super().__init__() self.wait_time = 1 self.api = twitter.Api(**parse(TWITTER_API_CONFIG_PATH, 'twitter-API')) self.data: List = [] self.keywords = [] self.total_crawled_count = 0 self.cache: CacheSet[int] = CacheSet()
def __call__(*args, **kwargs): """returns a newly created connection, which is not maintained by the _pool""" connection = psycopg2.connect( *args, **parse(DATABASE_CONFIG_PATH, 'postgresql', unwanted_fields=["minconn", "maxconn"]), **kwargs) Connection.get_connection_status(connection) return connection
def __init__(self, extractor: ExtractorBase = None, dumper: DumperBase = None): super().__init__(extractor, dumper) self.api = twitter.Api(**parse(TWITTER_API_CONFIG_PATH, 'twitter-API')) self.data = [] self.keywords = [] self.total_crawled_count = 0 self.crawled_id_set: Set[int] = set() self.data_from_db_count = 0
def config(): return parse(DATABASE_CONFIG_PATH, 'postgresql')
import string import requests import rootpath import twitter from flask import Blueprint, make_response, jsonify, request as flask_request from router.data_router import fill_series, gen_date_series rootpath.append() from backend.connection import Connection from paths import TWITTER_API_CONFIG_PATH from backend.utilities.ini_parser import parse bp = Blueprint('tweet', __name__, url_prefix='/tweet') api = twitter.Api(**parse(TWITTER_API_CONFIG_PATH, 'twitter-API')) @bp.route("/live-tweet") def send_live_tweet(): """ (unused)(deprecated) :return: """ # Simulate request from a mac browser headers = { 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/72.0.3626.121 Safari/537.36 ' }
def __init__(self): super().__init__() self.wait_time = 1 self.api = twitter.Api(**parse(TWITTER_API_CONFIG_PATH, 'twitter-API')) self.data: List[twitter.Status] = [] self.total_crawled_count = 0