Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python_open_ai
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
python_open_ai
Commits
8824f6b0
Commit
8824f6b0
authored
Apr 10, 2023
by
lei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
a61d5385
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
Helper.py
+14
-7
No files found.
Helper.py
View file @
8824f6b0
...
...
@@ -17,7 +17,7 @@ from aredis import StrictRedis, ConnectionPool
from
web3._utils.abi
import
get_abi_output_types
,
map_abi_data
from
web3._utils.normalizers
import
BASE_RETURN_NORMALIZERS
uni256Max
=
2
**
256
uni256Max
=
2
**
256
class
RedisConnSingleton
(
object
):
...
...
@@ -31,7 +31,8 @@ class RedisConnSingleton(object):
:param kwargs:
"""
if
cls
.
_instance
is
None
:
cls
.
_instance
=
redis
.
ConnectionPool
(
max_connections
=
1000
,
host
=
'114.132.50.141'
,
port
=
6379
,
db
=
0
,
password
=
'lhj123456'
)
cls
.
_instance
=
redis
.
ConnectionPool
(
max_connections
=
1000
,
host
=
'42.194.143.229'
,
port
=
6379
,
db
=
0
,
password
=
'a123456,a'
)
return
cls
.
_instance
...
...
@@ -46,7 +47,8 @@ class RedisConnectionPoolSingleton(object):
:param kwargs:
"""
if
cls
.
_instance
is
None
:
cls
.
_instance
=
ConnectionPool
(
max_connections
=
1000
,
host
=
'114.132.50.141'
,
port
=
6379
,
db
=
0
,
password
=
'lhj123456'
)
cls
.
_instance
=
ConnectionPool
(
max_connections
=
1000
,
host
=
'42.194.143.229'
,
port
=
6379
,
db
=
0
,
password
=
'a123456,a'
)
return
cls
.
_instance
...
...
@@ -190,13 +192,15 @@ class RedisCon:
class
Helper
:
"""公共基础类"""
@staticmethod
def
getProxyLst
():
"""获取代理列表"""
proxy_lst
=
list
()
for
i
in
range
(
5
):
try
:
response
=
requests
.
get
(
"https://proxy.webshare.io/api/v2/proxy/list/download/pgewrawzvvqtzwdzjfdfswvkwcjasmofoucnfyyq/-/any/username/direct/-/"
)
.
text
response
=
requests
.
get
(
"https://proxy.webshare.io/api/v2/proxy/list/download/pgewrawzvvqtzwdzjfdfswvkwcjasmofoucnfyyq/-/any/username/direct/-/"
)
.
text
a
=
response
.
split
(
'
\r\n
'
)
proxy_lst
=
a
[:
-
1
]
proxy_lst
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
),
proxy_lst
))
...
...
@@ -1100,7 +1104,8 @@ class Helper:
return
amountIn
,
amountOut
@staticmethod
async
def
get_usd_price_V2
(
p_token
,
p_token_d
,
p_token_symbol
,
price
,
usd_token
,
uToken
,
redisKey
,
Router
,
uDecimals
,
web_async
):
async
def
get_usd_price_V2
(
p_token
,
p_token_d
,
p_token_symbol
,
price
,
usd_token
,
uToken
,
redisKey
,
Router
,
uDecimals
,
web_async
):
"""
get usd price
...
...
@@ -1124,7 +1129,8 @@ class Helper:
return
usd_price
@staticmethod
async
def
get_token_detail
(
p_token
,
p_token_d
,
p_token_symbol
,
pool_address
,
usd_token
,
wToken
,
wDecimals
,
uToken
,
uDecimals
,
redisKey
,
Router
,
swapType
,
p_amount
,
web_async
):
async
def
get_token_detail
(
p_token
,
p_token_d
,
p_token_symbol
,
pool_address
,
usd_token
,
wToken
,
wDecimals
,
uToken
,
uDecimals
,
redisKey
,
Router
,
swapType
,
p_amount
,
web_async
):
"""
get token info
...
...
@@ -1212,7 +1218,8 @@ class Helper:
await
Helper
.
task_list
(
'chain:holderQueue'
,
json
.
dumps
(
data_
))
else
:
await
Helper
.
task_list
(
'chain:holderQueue'
,
json
.
dumps
(
data_
))
await
Helper
.
redis_data
(
data
,
token_detail
,
ts_
,
redisKey
,
public_token
,
chainId
,
stable
,
search_table
,
web_async
)
await
Helper
.
redis_data
(
data
,
token_detail
,
ts_
,
redisKey
,
public_token
,
chainId
,
stable
,
search_table
,
web_async
)
@staticmethod
def
get_time
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment