Ejemplo n.º 1
0
import os
from dataclasses import dataclass, field

from pyaml_env import parse_config

from cowidev.utils.paths import SECRETS_FILE


if os.path.isfile(SECRETS_FILE):
    secrets_raw = parse_config(SECRETS_FILE, raise_if_na=False)
else:
    secrets_raw = {}


@dataclass()
class GoogleSecrets:
    client_secrets: str = ""
    mail: str = None


@dataclass()
class VaccinationsSecrets:
    post: str = None
    sheet_id: str = None


@dataclass()
class TestingSecrets:
    post: str = None
    sheet_id: str = None
    sheet_id_attempted: str = None
Ejemplo n.º 2
0
 def _load_yaml(self):
     if self.config_file_exists:
         return parse_config(self.config_file, raise_if_na=False)
     return {}
Ejemplo n.º 3
0
from web3 import Web3
from abis import weth_abi
from pyaml_env import parse_config
from dotenv import load_dotenv
import os

load_dotenv()

config = parse_config("./config.yaml")
network = config["networks"]["active"]
my_address = Web3.toChecksumAddress(os.getenv("MY_ADDRESS"))
AMOUNT = 1000000000000000000  # 1 WETH/ETH


def main():
    """
    Runs the get_weth function to get WETH
    """
    get_weth()


def get_weth():
    """
    Mints WETH by depositing ETH.
    """
    print("Getting WETH!")
    w3 = Web3(Web3.HTTPProvider(config["networks"][network]["rpc_url"]))
    nonce = w3.eth.getTransactionCount(my_address)
    weth_address = Web3.toChecksumAddress(
        config["networks"][network]["weth_token"])
    weth = w3.eth.contract(address=weth_address, abi=weth_abi)
Ejemplo n.º 4
0
import pathlib
import yaml

from pyaml_env import parse_config

BASE_DIR = pathlib.Path(__file__).parent.parent
config_path = BASE_DIR / 'config' / 'aio_proxy.yaml'

config = parse_config(config_path)
Ejemplo n.º 5
0
from dataclasses import dataclass
from pyaml_env import parse_config

from cowidev.utils.paths import CONFIG_FILE
from cowidev.utils.exceptions import ConfigFileError

config_raw = parse_config(CONFIG_FILE, raise_if_na=False)
if config_raw is None:
    raise ConfigFileError(
        f"Empty configuration file! Check content from {CONFIG_FILE}.")


@dataclass()
class VaccinationsProcessConfig:
    skip_complete: list
    skip_monotonic_check: list
    skip_anomaly_check: list


@dataclass()
class BaseGetConfig:
    countries: list
    skip_countries: list


@dataclass()
class TestingGetConfig(BaseGetConfig):
    pass


@dataclass()