This release is a pre-release and may not be stable for production use.
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.jsontoconfig/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.jsontoconfig/transfers_config.json - configure as needed.
- run
bin/transfers_all_chains.py - output is in
data/transfers.csv
Metadata
Release files for subscrape 1.0.1rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| subscrape-1.0.1rc1.tar.gz | 26.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| subscrape-1.0.1rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.8 kB
Release files / subscrape-1.0.1rc1.tar.gz
| Download URL | subscrape-1.0.1rc1.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8af4761b0bb9cfe5a9c2fa8addb29806ec20e563de0e7f1aba7d954af4efecf1
|
|
BLAKE2b-256 checksum How to use checksums |
140fe9286549eac7176da8e865142cd85cd4b3461676d20111680b6696c74083
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / subscrape-1.0.1rc1-py3-none-any.whl
| Download URL | subscrape-1.0.1rc1-py3-none-any.whl |
|---|---|
| Size | 25.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63843edcb9c5c2bd57b778b0b7199fe0873bda70e64b38c7c4e71bed45da7f93
|
|
BLAKE2b-256 checksum How to use checksums |
c4ae8ddfba21dd1edf1fcc8bf4ea3a999b9c94643e65ce19ad4f7179a2b527c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|