53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
import dataclasses
|
|
import datetime
|
|
import logging
|
|
import re
|
|
import secrets
|
|
|
|
import bs4
|
|
|
|
import personal_data.html_util
|
|
import personal_data.parse_util
|
|
from personal_data.data import DeduplicateMode, Scraper
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
# mainnet: https://reader.partisiablockchain.com
|
|
# testnet: https://node1.testnet.partisiablockchain.com
|
|
|
|
|
|
HOSTNAME = 'reader.partisiablockchain.com'
|
|
|
|
URL_ACCOUNT_PLUGIN = 'https://{hostname}/{shard}blockchain/accountPlugin/local'
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class MpcBalance(Scraper):
|
|
dataset_name = 'defi_mpc_balance'
|
|
deduplicate_mode = DeduplicateMode.BY_ALL_COLUMNS
|
|
|
|
def scrape(self):
|
|
address = '0019e9a28c978dd65114cc4e0bcb876770805b0349' # TODO
|
|
|
|
headers = {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json',
|
|
}
|
|
|
|
url = URL_ACCOUNT_PLUGIN.format(
|
|
hostname = HOSTNAME,
|
|
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)
|
|
response.raise_for_status()
|
|
|
|
json = response.json()
|
|
print(json)
|
|
|
|
assert False
|
|
|
|
|