A Python scraper for substrate chains
Project description
subscrape
This is a growing library of Python facilities to scrape Substrate and Moonbeam-based chains. Substrate chains are scraped using Subscan while EVM-based chains use Moonscan.io and Blockscout.io.
Roadmap: https://app.subsocial.network/@alice_und_bob/subscrape-releasing-v1-0-and-roadmap-for-v2-0-32075
The basic workflow of bin/scrape.py
considers the configuration presented in data/scrape_config.json
to traverse through the given chains and perform the operations for each chain.
For Substrate, scraping extrinsics and transfers is supported.
Data is stored locally using SubscanDB
and can be used to use the data and transform it. The application works in a way that subsequent runs will only fetch deltas.
bin/transfers_all_chains.py
takes addresses and chains from data/transfers_config.json
to create a CSV of
all transfers associated with that accounts.
Links
Documentation
Limitations
Error handling is not very sophisticated, so if the scrape is interrupted by an uncaught exception, the delta might be incomplete and subsequent runs might miss some data. To remedy the issue, the delta must be deleted and the scraper run again.
Usage
Installation
virtualenv venv venv\scripts\activate pip install -Ur .\PipRequirements.txt bin\scrape.py
Subscan API Key
If you have a Subscan API key, drop it in a file named config/subscan-key
. Similarly, if you have a Moonscan.io API key, drop it in a file named config/moonscan-key
.
Example applications
Take a look at the /bin/
folder. There are some sample applications there.
Using scrape.py as application
- copy
config/sample_scrape_config.json
toconfig/scrape_config.json
- configure to your desire. See configuration
- run
scrape.py
- corresponding files will be created in data/
Consuming scrape.py as helper
- from scrape import scrape
- create a dict analogouos to
config/sample_scrape_config.json
- call it inline via
scrape(config)
Extracting all transfers across chains for an address
- copy
config/sample_transfers_config.json
toconfig/transfers_config.json
- configure as needed.
- run
bin/transfers_all_chains.py
- output is in
data/transfers.csv
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file subscrape-1.0.1rc1.tar.gz
.
File metadata
- Download URL: subscrape-1.0.1rc1.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8af4761b0bb9cfe5a9c2fa8addb29806ec20e563de0e7f1aba7d954af4efecf1 |
|
MD5 | d0c9212abe3f8b4744970f4e13b8c5a0 |
|
BLAKE2b-256 | 140fe9286549eac7176da8e865142cd85cd4b3461676d20111680b6696c74083 |
File details
Details for the file subscrape-1.0.1rc1-py3-none-any.whl
.
File metadata
- Download URL: subscrape-1.0.1rc1-py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63843edcb9c5c2bd57b778b0b7199fe0873bda70e64b38c7c4e71bed45da7f93 |
|
MD5 | 1a02ca6675a6a132812bfdace2c7455a |
|
BLAKE2b-256 | c4ae8ddfba21dd1edf1fcc8bf4ea3a999b9c94643e65ce19ad4f7179a2b527c0 |