Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scraper: Consider implementing a config class to handle type annotation in a named way #150

Open
nicolassaw opened this issue Sep 22, 2024 · 0 comments
Assignees
Labels

Comments

@nicolassaw
Copy link
Contributor

Recommended and quoted from Matt on #141:

"So this tuple type totally works and is very usable, but you might consider implementing a config class to hold all of these in a named way. That might look something like this:

from dataclasses import dataclass

@dataclass
class ScraperConfig:
    ms_wait: Optional[int] = None
    start_date: str | None = None  # this is an alternate way to do the type btw, some people prefer it. Optonal[T] == T | None
    end_date: str | None = None
    ...

Then you can use it like my_config = Config(ms_wait=100, end_date='2024-01-01', ...) and access the fields like my_config.ms_wait"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🔖 To-do
Development

No branches or pull requests

1 participant