Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 411 Bytes

prefect_task_subclass.md

File metadata and controls

18 lines (12 loc) · 411 Bytes

Prefect Task Subclassing

A prefect Task class can be customized further with subclassing:

from prefect import Task

class HTTPGetTask(Task):

    def __init__(self, username, password, **kwargs):
        self.username = username
        self.password = password
        super().__init__(**kwargs)

    def run(self, url):
        return requests.get(url, auth=(self.username, self.password))