def handle(self): sku = self.option('sku') country = self.option('country') if self.option('country') else 'usa' AppLoop().get_loop().run_until_complete(CurlScraper(country).update_product({ 'provider_sku':sku, 'provider_link': f'https://amazon.com.mx/-/es/dp/{sku}' }))
def handle(self): seller_id = int(self.option('seller-id')) business = self.option('business').lower().strip() switch = { 'alfredo': CtrlBusiness().alfredo_form, 'dominicana': CtrlBusiness().dominicana_form } AppLoop().get_loop().run_until_complete( CtrlBusiness().calculate_price(store_id=seller_id, func=switch[business]))
def handle(self): headless = bool(self.option('headless')) profile_name = self.option('profile-name') args = self.option('args') if args: args = args.split(',') else: args = [] AppLoop().get_loop().run_until_complete(MyPyppeteer().open_browser( headless=headless, profile_name=profile_name, args=args))
async def starts(self): try: cmd = r"ip -o -4 addr show|grep ' en\| eth\| wl'|awk '{print $4}'|cut -d/ -f1" # deja solo las redes : "enp|eth" sin vpn sin docker ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ips = ps.communicate()[0].decode().strip().split() except Exception as e: # si es windows logging.getLogger('log_print').error(f"Error, {e}, es windows?") ips = ["0.0.0.0"] if not ips: raise Exception("no hay ips de salida disponibles") self.sessions = [] self.ip_publics = [] coros = [] for ip in ips: conn = aiohttp.connector.TCPConnector(local_addr=(ip, 0), limit=300, loop=AppLoop().get_loop()) session = AutoRetrySession( connector=conn, headers={ "User-Agent": "Mozilla/5.0 (compatible MSIE 9.0 Windows NT 6.1 Trident/5.0)" }, ) coros.append(self.internet_check(session, skip=len(ips) > 10)) self.sessions = filter(None, await asyncio.gather(*coros)) if len(self.ip_publics) > 0: logging.getLogger("log_print").info( f"Usando {len(self.ip_publics)} Ips_rotativas") else: raise Exception( f"Error, no hay ips disponibles con internet testeado con: {self.url_judges}" ) exit() self.all_sessions = self.get_all_sessions()
async def mysql_pool_create(self, conn_config): parammeters = ( "host", "port", "db", "user", "password", ) self.conn_config = {param: conn_config[param] for param in parammeters} try: self.pool = await aiomysql.create_pool( cursorclass=aiomysql.cursors.DictCursor, maxsize=15, autocommit=True, loop=AppLoop().get_loop(), charset="utf8mb4", **self.conn_config, ) except Exception: self.conn_config.pop("password") logging.getLogger("log").error( f"Error in create_pool {self.conn_config}") raise return self
def handle(self): profile_name = self.option('profile-name') AppLoop().get_loop().run_until_complete( MyPyppeteer(profile_name).start_rotate_pages())
def handle(self): AppLoop().get_loop().run_until_complete( CtrlAnicam().shipping_by_product())
from cleo import Application from packages.core.utils.app_loop import AppLoop from packages.core.modules import ModuleManager from packages.core.utils.logger import Logger if __name__ == '__main__': application = Application("Go Shop Commands", 0.1, complete=True) AppLoop() ModuleManager().import_commands(application) Logger() application.run()
def handle(self): country = self.option('country') if self.option('country') else 'usa' init_page = int(self.option('init-page'))-1 if self.option('init-page') else 0 uri = self.option('uri') AppLoop().get_loop().run_until_complete( CurlScraper(country).scraper_pages(uri, init_page))
def handle(self): AppLoop().get_loop().run_until_complete(CurlScraper().update_products())
def handle(self): sku = self.option('sku') country = self.option('country') if self.option('country') else 'usa' AppLoop().get_loop().run_until_complete( PyppeteerScraper(country).get_product(sku))