Пример #1
0
 async def trace_chains(self):
     name = self.hand['session_name']
     link = self.fire_url
     redis = await aioredis.create_redis('redis://localhost', db=7)
     logging.info("trace: %s" % colored(link, 'green'))
     await redis.hset(name + "-chains", link, self.order)
     redis.close()
Пример #2
0
def fill_address_details():
    driver.get(
        'https://orders.eatapp.online/menu/golden-crust-baulkham-hills#ordering-for-prompt'
    )
    try:
        redis = Redis(host="server.local",
                      password=os.environ['REDISCLI_AUTH'])
        bw = BitwardenDAO(redis.get('bw_password'))
        redis.close()
        credentials = bw.get_item('b4651e5a-157a-45b0-84e6-ad1e00d1a8f5')
        driver.find_element_by_xpath(
            '//*[@id="menu-app"]/div[7]/div/div/div/div/button').click()
        driver.implicitly_wait(10)
        driver.find_element_by_xpath(
            '/html/body/div[1]/div[7]/div/div/div/div/form/div[2]/input'
        ).send_keys(credentials['login']['username'])
        driver.find_element_by_xpath(
            '/html/body/div[1]/div[7]/div/div/div/div/form/div[3]/input'
        ).send_keys(credentials['login']['password'])
        driver.find_element_by_xpath(
            '/html/body/div[1]/div[7]/div/div/div/div/form/div[4]/button'
        ).click()
        time.sleep(2)
        driver.find_element_by_xpath(
            '//*[@id="start-order-type"]/div[1]/div[2]/button[3]').click()
        driver.find_element_by_xpath(
            '//*[@id="start-order-time-info"]/div[2]/button[1]').click()
        driver.find_element_by_xpath('//*[@id="start-order"]').click()
    except ElementClickInterceptedException:
        print("Exception: " + driver.find_element_by_xpath(
            '//*[@id="start-order-time-info"]/div[3]').text)

    time.sleep(5)
Пример #3
0
 async def query(self, num_requests, key_space):
     #redis = await aioredis.create_redis(
     #    ('localhost', self.port), loop=self.loop)
     redis = self.rredis
     for i in range(num_requests):
         key = int(key_space * self.client_id + i % key_space)
         val = await redis.get('pymemtier_' + str(key))
     redis.close()
Пример #4
0
async def test_aioredis(i, loop):
    start = time.time()
    redis = await aioredis.create_redis((HOST, 6379), loop=loop)
    val = None
    for i in range(i):
        val = await redis.keys('*')
    print(time.time() - start)
    redis.close()
    await redis.wait_closed()
    return val
Пример #5
0
async def aioredis_set_get():
    # Redis client bound to single connection (no auto reconnection).
    redis = await aioredis.create_redis('redis://localhost:6379')
    await redis.set('my-key', 'value1')
    val = await redis.get('my-key', encoding='utf-8')
    print(val)

    # gracefully closing underlying connection
    redis.close()
    await redis.wait_closed()
Пример #6
0
async def consumer_redis(loop):
    redis = await aioredis.create_redis_pool('redis://127.0.0.1:6379',
                                             db=0,
                                             loop=loop,
                                             minsize=5,
                                             maxsize=50)
    r = await redis.lpop('log-msg')
    redis.close()
    await redis.wait_closed()
    return r
Пример #7
0
async def aioredis_transactions2():
    redis = await aioredis.create_redis('redis://localhost')
    await redis.delete('foo', 'bar')
    tr = redis.multi_exec()
    fut1 = tr.incr('foo')
    fut2 = tr.incr('bar')
    res = await tr.execute()
    res2 = await asyncio.gather(fut1, fut2)
    print(res, res2)
    # assert res == res2

    redis.close()
    await redis.wait_closed()
Пример #8
0
async def is_resolver_working(test_ip):
    # loop = asyncio.get_event_loop()
    try:
        resolver = ProxyResolver()
        resolver.set_proxies([test_ip, ])
        # res = loop.run_until_complete(resolver.query('www.baidu.com', types.A))
        res = await resolver.query('abc.com', types.ANY, timeout=1.5)
        # print('scanning: %s' % test_ip)
        # print(res)
        if res and len(res.an) > 5:  # response is exists and have A-records in it
            # print(test_ip + ' is open resolver')
            # print(len(res.an))
            # print(res)

            # this is works, 5000 thread size processed in 10 seconds. without redis - 5 seconds, delta is 5 seconds,
            # so it will be 0.1 sec to async redis call
            redis = await aioredis.create_redis(('localhost', 6379))
            await redis.rpush('resolvers', test_ip)
            redis.close()
            return True
    except TypeError:
        return False
    # print(test_ip + ' is NOT an open resolver')
    return False
Пример #9
0
-- 填入上面查到的  channel id   style_id
update t_ship_print_template_style ts
set ts.img= 'https://album.bigseller.com/static/template/printimg/0abc368aaafc124975787c6d6ab8d6cd.jpg',
    ts.thumbnail='https://album.bigseller.com/static/template/printimg/ef1de3d4a8dd8ad0dbd1bc2488eb3524.jpg',
    ts.update_time=sysdate()
where channel_id = ?
  and id = ?;
-- 填入上面查到的  channel id
INSERT INTO t_ship_print_template_style (channel_id, name, lang_key, type, img, thumbnail, is_default)
VALUES (?, 'Label With Product Info', 'ship.config.label.template.with.product', 1,
        'https://album.bigseller.com/static/template/printimg/101f47a941b73c1f0a2f7b25ec8a2908.jpg',
        'https://album.bigseller.com/static/template/printimg/833f866accc29ad0a5db6a870755e8db.jpg', 0);
-- 填入上面插入一条记录产生的 style id
INSERT INTO t_ship_print_template_size (template_style_id, size, lang_key, size_source, additional_type, url,
                                               is_senderInfo)
VALUES (?, '100*150mm', 'ship.config.label.template.size.thermal.fifteen', 1, 1, '/10x15/label/shopee-express-my_15.ftl',
        1);
"""
data = {
    "key": "sql.shopee.my.express.online",
    "content": lines,
    "desc": "shopee 马来面单 express 加拣货信息",
    "date": '2020-10-15'
}

redis.set(name='sql.shopee.my.express.online',
          value=gzip_compress(json.dumps(data, ensure_ascii=False)))

redis.close()
Пример #10
0
async def release_lock():
	global redis
	redis.close()
Пример #11
0
def close_redis(e=None):
    redis = g.pop("redis", None)

    if redis is not None:
        redis.close()