partisia blockchain v2
This commit is contained in:
parent
5f5e7e6776
commit
2a6cd4b9f3
|
@ -2,6 +2,7 @@ import dataclasses
|
|||
import datetime
|
||||
import logging
|
||||
import re
|
||||
import json
|
||||
import secrets
|
||||
|
||||
import bs4
|
||||
|
@ -20,6 +21,7 @@ logger = logging.getLogger(__name__)
|
|||
HOSTNAME = 'reader.partisiablockchain.com'
|
||||
|
||||
URL_ACCOUNT_PLUGIN = 'https://{hostname}/{shard}blockchain/accountPlugin/local'
|
||||
URL_ACCOUNT_PLUGIN_GLOBAL = 'https://{hostname}/{shard}blockchain/accountPlugin/global'
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class MpcBalance(Scraper):
|
||||
|
@ -39,14 +41,20 @@ class MpcBalance(Scraper):
|
|||
shard = 'shards/Shard0/',
|
||||
)
|
||||
|
||||
data = f"{{\"path\":[{{\"type\":\"field\",\"name\":\"accounts\"}},{{\"type\":\"avl\",\"keyType\":\"BLOCKCHAIN_ADDRESS\",\"key\":\"{address}\"}}]}}"
|
||||
print(data)
|
||||
response = self.session.post(url, headers = headers, data=data)
|
||||
data = {'path':[{'type':'field','name':'accounts'},{'type':'avl','keyType':'BLOCKCHAIN_ADDRESS','key':address}]}
|
||||
response = self.session.post(url, headers = headers, data=json.dumps(data))
|
||||
response.raise_for_status()
|
||||
print(response.headers)
|
||||
|
||||
json = response.json()
|
||||
print(json)
|
||||
json_data = response.json()
|
||||
print(json_data )
|
||||
|
||||
assert False
|
||||
data_point = {
|
||||
'account.address': address,
|
||||
'account.update_time': response.headers.get('last-modified') or response.headers.get('date'),
|
||||
}
|
||||
|
||||
data_point['balance.MPC'] = json_data['mpcTokens']
|
||||
print(data_point)
|
||||
|
||||
yield data_point
|
||||
|
|
|
@ -13,11 +13,6 @@ def scrape_played_last(session):
|
|||
response = session.get(URL_RECENTLY_PLAYED_HTML, cookies=session.cookies)
|
||||
response.raise_for_status()
|
||||
|
||||
print('From herp')
|
||||
for cookie in session.cookies:
|
||||
print(' ', cookie.domain, cookie)
|
||||
exit(1)
|
||||
|
||||
# Now trigger API call.
|
||||
logger.warning('Trying to fetch data from API')
|
||||
headers = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user