Esempio n. 1
0
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
#
# @AUTHOR: Rabbir
# @FILE: /root/Github/dmarket-trading-bot/main.py
# @DATE: 2020/12/29 Tue
# @TIME: 16:39:37
#
# @DESCRIPTION: dmarket-trading-bot 主模块


import config_loader
from rab_python_packages import rab_logging


# 日志记录
main_logger = rab_logging.build_rab_logger()
import re
import time
import urllib
import zipfile
import platform
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# 切换路径到父级
import sys
sys.path.append("..")
from rab_python_packages import rab_logging

# 日志记录
rab_chrome_logger = rab_logging.build_rab_logger()
"""
@description: 在指定端口构建浏览器
-------
@param: port_num<int>
-------
@return:
"""


def build_chrome(port_num, headless=False):
    # Linux 下什么都不做
    if ("Linux" in str(platform.platform()) or headless):
        return True
    # Windows 下在对应端口起浏览器
    else:
Esempio n. 3
0
# @DESCRIPTION: 共通包 代理获取模块

import json
import time
import hashlib
import requests
import psycopg2
import psycopg2.extras
# 切换路径到父级
import sys
sys.path.append("..")
from rab_python_packages import rab_logging
from rab_python_packages import rab_pgsql_driver

# 日志记录
rab_proxy_logger = rab_logging.build_rab_logger()
"""
@description: 从数据库获取所有代理 IP 和其对应代理端口
-------
@param:
-------
@return: proxies<dict>
"""


def get_proxies(database, user, password, host, port, table_name, area=None):
    # 连接数据库并执行 SQL 语句
    r_pgsql_driver = rab_pgsql_driver.r_pgsql_driver(database=database,
                                                     user=user,
                                                     password=password,
                                                     host=host,
# @AUTHOR: Rabbir
# @FILE: \rab_python_packages\rab_pgsql_driver.py
# @DATE: 2020/12/17 周四
# @TIME: 11:03:40
#
# @DESCRIPTION: 共通包 PostgreSQL 数据库驱动

import psycopg2
import psycopg2.extras
# 切换路径到父级
import sys
sys.path.append("..")
from rab_python_packages import rab_logging

# 日志记录
rab_pgsql_driver_logger = rab_logging.build_rab_logger()
"""
@description: 批量插入数值获取
-------
@param:
-------
@return: batch_size<int>
"""


def get_batch_size():
    return 500


"""
@description: r_proxy 类