Example #1
0
 def get(self, userid):
     cursor = self.conn.cursor()
     query = "SELECT id, username, password, full_name, email FROM user WHERE id = ?"
     cursor.execute(query, (userid,))
     manager = cursor.fetchone()
     cursor.close()
     return Manager(manager[0], manager[1], manager[2], manager[3], manager[4])
Example #2
0
    def __init__(self):
        self.CONFIG_FILENAME = 'config/config.ini'
        self._config = None
        self._api = None
        self._gpsDevice = None
        self._accelDevice = None
        self._thermoDevice = None
        self._voltDevice = None
        self._baroDevice = None
        self._obdDevice = None
        self.read_configuration_file()
        self.configure_obd()
        self.configure_gps()
        self.configure_thermo()
        self.configure_acceleromenter()
        self.configure_volt()
        self.configure_baro()

        self._deviceList = DeviceCollection(thermoDevice=self._thermoDevice,
                                            gpsDevice=self._gpsDevice,
                                            accelDevice=self._accelDevice,
                                            voltDevice=self._voltDevice,
                                            baroDevice=self._baroDevice,
                                            obdDevice=self._obdDevice)
        self._manager = Manager(self._config, self._deviceList)
 def edit(self, userid, json):
     if json['username'] and json['email'] and json['full_name']:
         user = Manager(userid, json['username'], json['email'], 0,
                        json['full_name'])
         manager = ManagerDAO().edit(user)
         return jsonify(Manager=manager.serialize()), OK
     else:
         return jsonify(Error='Unexpected attributes in post'), BAD_REQUEST
Example #4
0
 def getByTeamID(self, tid):
     cursor = self.conn.cursor()
     query = "SELECT user.id, username, password, full_name, email FROM (user JOIN manages ON user.id = user_id) WHERE team_id = ? ORDER BY full_name"
     cursor.execute(query, (tid,))
     result = cursor.fetchall()
     managers = [Manager(manager[0], manager[1], manager[2], manager[3], manager[4]) for manager in result]
     cursor.close()
     self.conn.close()
     return managers
Example #5
0
 def getAll(self):
     cursor = self.conn.cursor()
     query = "SELECT id, username, password, full_name, email FROM user"
     cursor.execute(query)
     result = cursor.fetchall()
     manager_tupl = [manager for manager in result]
     manager_obj = [Manager(manager[0], manager[1], manager[2], manager[3], manager[4]) for manager in manager_tupl]
     cursor.close()
     self.conn.close()
     return manager_obj
Example #6
0
 def getByUsername(self, username):
     cursor = self.conn.cursor()
     query = "SELECT user.id, username, password, full_name, email FROM user WHERE username = ?"
     cursor.execute(query, (username,))
     result = cursor.fetchall()
     if result:
         managers = [Manager(manager[0], manager[1], manager[2], manager[3], manager[4]) for manager in result]
         return managers[0]
     else:
         return None
def main(parsed_args):
    manager = Manager()
    start_input_worker(manager, parsed_args.get_domain(),
                       parsed_args.get_resolvers_filename(),
                       parsed_args.get_subdomains_filename(),
                       parsed_args.include_auth_ns())
    start_dns_workers(manager, parsed_args.get_workers())
    start_output_worker_and_wait_for(manager,
                                     parsed_args.get_output_filename(),
                                     parsed_args.get_output_mode())
 def register(self, json):
     if json['username'] and json['email'] and json['password'] and json[
             'full_name']:
         if not ManagerDAO().getByUsername(json['username']):
             # json['password'] = sha256_crypt.hash(json['password'])
             print(len(json['password']))
             new_manager = Manager(0, json['username'], json['password'],
                                   json['full_name'], json['email'])
             manager = ManagerDAO().add(new_manager)
             return jsonify(isAuth=True,
                            UserID=manager.user_id,
                            Username=manager.username), CREATED
         else:
             return jsonify(Error='Username already in use'), BAD_REQUEST
     else:
         return jsonify(
             Error='Unexpected attributes in post request'), BAD_REQUEST
     pass
Example #9
0
    def process_task(self):
        """
        Downloader Module
        :return: Result Dict
        """
        start = time.time()
        try:
            task_url = self.task.url
            args = json.loads(self.task.args)
            project_name = self.project.name

            # Manager Module
            # localhost = socket.getfqdn(socket.gethostname())
            # local_ip = socket.gethostbyname(localhost)
            _dict = psutil.net_if_addrs()
            if _dict.has_key('docker0'):
                del _dict['docker0']
            _str = str(_dict)
            m1 = re.search(r".*address='(10.\d+.\d+.\d+)'.*", _str)
            m2 = re.search(r".*address='(192.\d+.\d+.\d+)'.*", _str)
            m3 = re.search(r".*address='(172.[1-3]\d.\d+.\d+)'.*", _str)
            if m1:
                local_ip = m1.group(1)
            elif m2:
                local_ip = m2.group(2)
            elif m3:
                local_ip = m3.group(3)
            else:
                local_ip = '127.0.0.1'
            manager = Manager(ip=local_ip, project_name=project_name)
            ip_tactics = manager.get_ip()

            print ip_tactics
            ip_tactics_dict = ip_tactics
            if ip_tactics_dict.get('is_granted', False) is False:
                raise IPLimitError(
                    "IP Access is Limited, Please Wait for Access Permission.")
            else:
                if isinstance(args, basestring):
                    args = json.loads(args)
                proxies_ip = ip_tactics_dict.get('proxies_ip', {})
                if proxies_ip:
                    args.update(
                        {'proxies': {
                            'http': 'http://%s' % (proxies_ip)
                        }})
                args = json.dumps(args)

            _spider = __import__("execute.{0}_spider".format(project_name),
                                 fromlist=["*"])

            reload(_spider)
            spider = _spider.Spider()

            resp = spider.start_downloader(task_url, args)
            result = None
            exec("result = spider.start_parser(resp, spider.{0})".format(
                self.task.callback))

            end = time.time()
            spend_time = end - start
            self.storage.update_task(task=self.task,
                                     status=4,
                                     track_log="success",
                                     spend_time=str(spend_time))
            if self.project.status == 1:
                return {"status": True, "store_result": True, "result": result}
            else:
                return {
                    "status": True,
                    "store_result": False,
                    "result": result
                }
        except IPLimitError:
            end = time.time()
            spend_time = end - start
            self.task = self.storage.update_task(
                task=self.task,
                status=0,
                track_log=traceback.format_exc(),
                spend_time=str(spend_time),
                retry_times=self.task.retry_times + 1,
            )

            return {
                "status": False,
                "store_result": False,
                "result": None,
                "reason": traceback.format_exc(),
            }

        except Exception:
            end = time.time()
            spend_time = end - start
            self.task = self.storage.update_task(
                task=self.task,
                status=3,
                track_log=traceback.format_exc(),
                spend_time=str(spend_time),
                retry_times=self.task.retry_times + 1,
            )

            return {
                "status": False,
                "store_result": False,
                "result": None,
                "reason": traceback.format_exc(),
            }
Example #10
0
class Player(Entity):
    id = field.PrimaryKey(storetype.Integer(), name='player_id')


class Footballer(Player):
    name = field.Column(storetype.Text(max_length=80))
    match_fk = rel.ManyToMany('Match', name='match')


class Match(Entity):
    id = field.PrimaryKey(storetype.Integer(), name='match_id')
    player_fk = rel.ManyToMany('Footballer', name='player')


m = Manager()
conf = ConnectionConfiguration(user="******",
                               password="******",
                               database="postgres")
m.connect(conf)
m.create_tables()

# EXAMPLE 1 ######################## simple insert, update, delete ##################################

monkey = Monkey()
monkey.animal_id = 1
monkey.mammal_type = 'humanoid'
monkey.monkey_name = 'Ham'
monkey.monkey_weight = 20.5

m.insert(monkey)
Example #11
0
    # 서버시간 체크
    time_checker()

    # upbit 객체
    print("클라이언트 생성")
    ub_client = Ub_Client(ub_access_key, ub_secret_key)
    # binance 객체
    bn_client = Bn_Client(bn_access_key, bn_secret_key)
    # 주식 프로그램 객체
    app = QApplication(sys.argv)
    #kw_client = Kw_Client()
    print("클라이언트 완료")

    # # 매니저 관리 프로그램 on
    print("매니저등록 시작")
    ub_manager = Manager(ub_client)
    bn_manager = Manager(bn_client)
    #kw_manager = Manager(kw_client)
    print("매니저등록 완료")

    print("알고리즘 등록")
    # 변동성전략 등록
    # # 업비트 변동성돌파전략
    ub_will = William(ub_manager, ["KRW-BTC", "KRW-ETH"])
    # 바이낸스 변동성돌파전략
    # bn_will = William(bn_manager, ["BTCUSDT", "ETHUSDT", "BNBUSDT"])
    # 키움 변동성돌파전략
    #kw_will = William(kw_manager, ['069500', '122630', '233740', '114800', '229200', '133690'])
    # 업비트 원퍼센트 전략 등록
    # ub_one = One_percent(ub_manager, ["KRW-ADA", "KRW-BCH", "KRW-EOS", "KRW-ETC", "KRW-XLM", "KRW-TRX", "KRW-XRP"])
    # 업비트 10분 원퍼센트 전략등록, 모든 마켓 대상 5개 매수
Example #12
0
def create_manager():
    manager = Manager(('localhost', 9999))
    manager.start()
Example #13
0
File: main.py Project: rbak/leuka
from manager.manager import Manager

manager = Manager()
manager.start()
Example #14
0
"""
-------------------------------------------------
   File Name:     app
   Description :
   Author :       guodongqing
   date:          2019/11/11
-------------------------------------------------
"""

from flask import Flask, render_template, request, jsonify

from manager.manager import Manager
from util.Logger import Logger

logger = Logger.instance()
sysManager = Manager()
app = Flask(__name__)


def start_web_server(port=5500, debug=True):
    app.run(host='0.0.0.0', port=port, debug=debug)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/meeting')
def meeting():
    meetingUsers = sysManager.getAllMeetingUsers()
    logger.info(request.remote_addr + " - meeting user's size:" + str(len(meetingUsers)))
    return render_template('meetingusers.html', meetingUsers=meetingUsers)
Example #15
0
#!/usr/bin/python3
from manager.manager import Manager
from feeds import V4L2Feed, VideoTestFeed, SvgFeed, ImageFeed, DskFeed

import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst

if __name__ == "__main__":
    Gst.init(None)

    manager = Manager(('localhost', 9999))
    manager.register_feed_type(V4L2Feed, 'v4l2')
    manager.register_feed_type(VideoTestFeed, 'video_test')
    manager.register_feed_type(DskFeed, 'dsk', play_after_create=False)

    manager.create_feed(0, 'v4l2', '/dev/video0')
    manager.create_feed(1, 'video_test')
    manager.create_feed(2, 'video_test').set_pattern(1)
    manager.create_feed(3, 'video_test').set_pattern(18)

    dsk = manager.create_feed(8, 'dsk')
    dsk.create_slide('media/lower_third.svg', {'line1': 'New Headline'})
    dsk.select_slide(0)

    dsk = manager.create_feed(9, 'dsk')
    dsk.create_slide('media/live.svg')
    dsk.select_slide(0)

    manager.start()