|
""" |
|
This script is responsible for collecting data from various websites \ |
|
related to financial and policy information in China. It fetches data from various sources,\ |
|
extracts relevant information, translates it, and updates the content accordingly. |
|
Collected data includes policy interpretations, financial news, macroeconomic research. |
|
""" |
|
import logging |
|
import os |
|
|
|
from dotenv import load_dotenv |
|
from prefect import flow |
|
|
|
from source import cbirc, csrc, eastmoney, gov, mofcom, ndrc, safe, stats, mof, sohu_ccef |
|
|
|
|
|
load_dotenv() |
|
|
|
logging.basicConfig( |
|
format='%(asctime)s - %(levelname)s - %(funcName)s - %(message)s', |
|
datefmt="%Y-%m-%d %H:%M:%S", |
|
level=logging.INFO |
|
) |
|
|
|
delta = int(os.environ.get('DELTA') or '1') |
|
logging.info("DELTA = %s", delta) |
|
|
|
@flow(name="Data Collection - Daily", log_prints=True) |
|
def main(): |
|
""" |
|
Orchestrates the data collection process by calling the crawl functions of different sources. |
|
""" |
|
eastmoney.crawl(delta) |
|
|
|
csrc.crawl(delta) |
|
stats.crawl(delta) |
|
gov.crawl(delta) |
|
safe.crawl(delta) |
|
mofcom.crawl(delta) |
|
ndrc.crawl(delta) |
|
mof.crawl(delta) |
|
|
|
sohu_ccef.crawl(delta) |
|
|
|
if __name__ == '__main__': |
|
main() |
|
|