def initialize(self, config, include_version=False): try: self.config = config self.datastore = config.datastore self.data = {} self.paths = url_handler.gather_paths() self.datastore_handler = config.datastore_handler self.drivers_handler = config.drivers_handler self.proxy_handler = ProxyHandler(config = config) except: import traceback traceback.print_exc()
from proxy_handler import ProxyHandler businessses_response = requests.get( constants.ENDPOINT, params={ 'fetch': 'businesses', } ).text categories = json.loads( businessses_response ) proxy_handler = ProxyHandler() def begin(business): proxy = proxy_handler.getProxy() print (f"Fetching reviews for {business['displayName']} with proxy {proxy.ip}") # There are 20 reviews per page. So we take the amount of total reviews and we divide on 20 total_pages = (business['numberOfReviews'] / 20) + 1 # Always +1 for current_page in range(1,total_pages+1): # Retrieve the page url = f"https://www.trustpilot.com/review/{business['identifyingName']}?languages=en"
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, ConversationHandler from bot_config import token, adminlist from proxy_config import proxy as main_proxy from edu_parser.profile import Profile from edu_parser.exceptions import * from datetime import datetime from proxy_handler import ProxyHandler from requests.exceptions import ProxyError, ConnectionError import os bot = telegram.Bot(token=token) updater = Updater(token=token) dispatcher = updater.dispatcher if not main_proxy: proxies = ProxyHandler(proxy_path='good_proxies.txt') users = {} START_CREDENTIALS = 0 GET_TERM = 1 GET_DAY = 2 PREDICT_SUBJECT = 3 def check_creds(f): def wrap(bot, update): global users chat = update.message.chat_id try: return f(bot, update)