1
0

partisia blockchain v2

This commit is contained in:
Jon Michael Aanes 2024-04-16 23:38:35 +02:00
parent 5f5e7e6776
commit 2a6cd4b9f3
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
2 changed files with 14 additions and 11 deletions

View File

@ -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

View File

@ -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 = {