-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
97 lines (85 loc) · 2.56 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# from passlib.context import CryptContext
# pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
# print(pwd_context.encrypt('secret'))
# import asyncio
# import asyncpg
# from datetime import datetime
# async def run():
# conn = await asyncpg.connect(user='rolemee', password='',
# database='web-project' ,host='127.0.0.1')
# # values = await conn.execute(
# # """INSERT INTO web_project.test (test, test_time)
# # VALUES (1::integer, $1::timestamp);
# # """,
# # )
# sql = 'INSERT INTO web_project."test" ("test") VALUES ($1) RETURNING "test2";'
# # values = await conn.execute(
# # sql,1
# # )
# values = await conn.fetch(sql,1)
# print(values)
# await conn.close()
# print(values[0].get('test2'))
# return values
# loop = asyncio.get_event_loop()
# loop.run_until_complete(run())[0]
# from app.models import pgsql
#
# from datetime import datetime,date
# import time
# Date = date(date.today())
# print(date.day)
# print(Date)
import asyncio
import os
from meilisearch_python_async import Client
from datetime import date,timedelta
async def search(query_text:str = ""):
async with Client('http://127.0.0.1:7700') as client:
client =client.index('web_project')
res = await client.search(query_text)
print(res)
# import meilisearch
# client = meilisearch.Client('http://127.0.0.1:7700')
# print(client.index('web_project').search('百度', {
# 'attributesToCrop': ['title'],
# 'cropMarker': '',
# 'cropLength': 3
# }))
asyncio.run(search(''))
# loop = asyncio.get_event_loop()
# loop.run_until_complete(search('百度'))
import multiprocessing
from multiprocessing import Pool
import asyncio
import asyncpg
import string
from hashlib import sha256
global data
data = [11,22,33]
async def run(x):
global data
# bruteforce(lambda x:sha256(x.encode())==b'1251231231234',string.printable,10)
data.append(x)
# print(data)
# conn = await asyncpg.connect(user='rolemee', password='',
# database='web-project' ,host='127.0.0.1')
# values = await conn.execute(
# """INSERT INTO web_project.test (test)
# VALUES (1::integer);
# """,
# )
# await conn.close()
# return values
# def test(i):
# global data
# return asyncio.run(run(i))
# import json
# if __name__ == '__main__':
# print(data)
# print(type(data))
# data = multiprocessing.Manager().list()
# print(type(data))
# with Pool(6) as p:
# print(p.map(test, [1, 2, 3,4,5,6]))
# print(data)