kopia lustrzana https://github.com/bugout-dev/moonstream
Scaffolding for "mooncrawl ethcrawler trending"
rodzic
b0dc2c9e9c
commit
ea1a714e9b
|
@ -8,6 +8,8 @@ import sys
|
||||||
import time
|
import time
|
||||||
from typing import Iterator, List
|
from typing import Iterator, List
|
||||||
|
|
||||||
|
import dateutil.parser
|
||||||
|
|
||||||
from .ethereum import (
|
from .ethereum import (
|
||||||
crawl_blocks_executor,
|
crawl_blocks_executor,
|
||||||
crawl_blocks,
|
crawl_blocks,
|
||||||
|
@ -164,6 +166,11 @@ def ethcrawler_contracts_update_handler(args: argparse.Namespace) -> None:
|
||||||
json.dump(results, args.outfile)
|
json.dump(results, args.outfile)
|
||||||
|
|
||||||
|
|
||||||
|
def ethcrawler_trending_handler(args: argparse.Namespace) -> None:
|
||||||
|
with args.outfile:
|
||||||
|
print(args)
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser(description="Moonstream crawlers CLI")
|
parser = argparse.ArgumentParser(description="Moonstream crawlers CLI")
|
||||||
parser.set_defaults(func=lambda _: parser.print_help())
|
parser.set_defaults(func=lambda _: parser.print_help())
|
||||||
|
@ -314,6 +321,47 @@ def main() -> None:
|
||||||
func=ethcrawler_contracts_update_handler
|
func=ethcrawler_contracts_update_handler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser_ethcrawler_trending = subcommands_ethcrawler.add_parser(
|
||||||
|
"trending", description="Trending addresses on the Ethereum blockchain"
|
||||||
|
)
|
||||||
|
parser_ethcrawler_trending.add_argument(
|
||||||
|
"-s",
|
||||||
|
"--start",
|
||||||
|
type=dateutil.parser.parse,
|
||||||
|
required=True,
|
||||||
|
help="Start time for window to calculate trending addresses in",
|
||||||
|
)
|
||||||
|
parser_ethcrawler_trending.add_argument(
|
||||||
|
"--include-start",
|
||||||
|
action="store_true",
|
||||||
|
help="Set this flag if range should include start time",
|
||||||
|
)
|
||||||
|
parser_ethcrawler_trending.add_argument(
|
||||||
|
"-e",
|
||||||
|
"--end",
|
||||||
|
type=dateutil.parser.parse,
|
||||||
|
required=True,
|
||||||
|
help="End time for window to calculate trending addresses in",
|
||||||
|
)
|
||||||
|
parser_ethcrawler_trending.add_argument(
|
||||||
|
"--include-end",
|
||||||
|
action="store_true",
|
||||||
|
help="Set this flag if range should include end time",
|
||||||
|
)
|
||||||
|
parser_ethcrawler_trending.add_argument(
|
||||||
|
"--humbug",
|
||||||
|
default=None,
|
||||||
|
help="If you would like to write this data to a Moonstream journal, please provide a Humbug token for that here.",
|
||||||
|
)
|
||||||
|
parser_ethcrawler_trending.add_argument(
|
||||||
|
"-o",
|
||||||
|
"--outfile",
|
||||||
|
type=argparse.FileType("w"),
|
||||||
|
default=sys.stdout,
|
||||||
|
help="Optional file to write output to. By default, prints to stdout.",
|
||||||
|
)
|
||||||
|
parser_ethcrawler_trending.set_defaults(func=ethcrawler_trending_handler)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
args.func(args)
|
args.func(args)
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ setup(
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"moonstreamdb @ git+https://git@github.com/bugout-dev/moonstream.git@ec3278e192119d1e8a273cfaab6cb53890d2e8e9#egg=moonstreamdb&subdirectory=db",
|
"moonstreamdb @ git+https://git@github.com/bugout-dev/moonstream.git@ec3278e192119d1e8a273cfaab6cb53890d2e8e9#egg=moonstreamdb&subdirectory=db",
|
||||||
|
"python-dateutil",
|
||||||
"requests",
|
"requests",
|
||||||
"tqdm",
|
"tqdm",
|
||||||
"web3",
|
"web3",
|
||||||
|
|
Ładowanie…
Reference in New Issue