Skip to content

DraftBuzz SDK

Draft prospect data scraping client.

draftbuzz

AsyncScrapingBackend

Bases: Protocol

Protocol for asynchronous HTML scraping backends.

get_page_content async

get_page_content(url, wait_for_element)

Fetch a page's HTML content asynchronously.

Parameters:

Name Type Description Default
url str

The full URL to fetch.

required
wait_for_element str

CSS selector to wait for before extracting HTML.

required

Returns:

Type Description
str

The page's outer HTML as a string.

Source code in src/griddy/draftbuzz/backends.py
async def get_page_content(self, url: str, wait_for_element: str) -> str:
    """Fetch a page's HTML content asynchronously.

    Args:
        url: The full URL to fetch.
        wait_for_element: CSS selector to wait for before extracting HTML.

    Returns:
        The page's outer HTML as a string.
    """
    ...

ScrapingBackend

Bases: Protocol

Protocol for synchronous HTML scraping backends.

get_page_content

get_page_content(url, wait_for_element)

Fetch a page's HTML content.

Parameters:

Name Type Description Default
url str

The full URL to fetch.

required
wait_for_element str

CSS selector to wait for before extracting HTML.

required

Returns:

Type Description
str

The page's outer HTML as a string.

Source code in src/griddy/draftbuzz/backends.py
def get_page_content(self, url: str, wait_for_element: str) -> str:
    """Fetch a page's HTML content.

    Args:
        url: The full URL to fetch.
        wait_for_element: CSS selector to wait for before extracting HTML.

    Returns:
        The page's outer HTML as a string.
    """
    ...

GriddyDraftBuzz

GriddyDraftBuzz(
    draftbuzz_auth=None,
    server_idx=None,
    server_url=None,
    url_params=None,
    client=None,
    async_client=None,
    retry_config=UNSET,
    timeout_ms=None,
    debug_logger=None,
    headless=True,
    scraping_backend=None,
    async_scraping_backend=None,
)

Bases: LazySubSDKMixin, BaseGriddySDK, BaseSDK

Main client for accessing NFL Draft Buzz data.

Sub-SDKs are loaded lazily on first access to minimize startup time. Uses Playwright (Firefox) by default to render JavaScript-heavy pages on nfldraftbuzz.com. Requires the browser-auth optional extra::

pip install griddy[browser-auth]
Example

from griddy.draftbuzz import GriddyDraftBuzz draftbuzz = GriddyDraftBuzz() rankings = draftbuzz.rankings.get_position_rankings(position="QB")

Parameters:

Name Type Description Default
draftbuzz_auth Optional[Dict[str, str]]

Optional dictionary containing authentication information. DraftBuzz does not currently require auth, but this is available for future use.

None
server_idx Optional[int]

Index of the server to use from the server list.

None
server_url Optional[str]

Override the default server URL.

None
url_params Optional[Dict[str, str]]

Parameters to template into the server URL.

None
client Optional[HttpClient]

Custom synchronous HTTP client (must implement HttpClient).

None
async_client Optional[AsyncHttpClient]

Custom async HTTP client (must implement AsyncHttpClient).

None
retry_config Any

Configuration for automatic request retries.

UNSET
timeout_ms Optional[int]

Request timeout in milliseconds.

None
debug_logger Optional[Logger]

Custom logger for debug output.

None
headless bool

Run the Playwright browser in headless mode (default True). Ignored when a custom scraping_backend is provided.

True
scraping_backend Optional[ScrapingBackend]

A synchronous scraping backend that satisfies the :class:~griddy.draftbuzz.backends.ScrapingBackend protocol. When provided, overrides the default Playwright backend.

None
async_scraping_backend Optional[AsyncScrapingBackend]

An asynchronous scraping backend that satisfies the :class:~griddy.draftbuzz.backends.AsyncScrapingBackend protocol.

None
Source code in src/griddy/draftbuzz/sdk.py
def __init__(
    self,
    draftbuzz_auth: Optional[Dict[str, str]] = None,
    server_idx: Optional[int] = None,
    server_url: Optional[str] = None,
    url_params: Optional[Dict[str, str]] = None,
    client: Optional[HttpClient] = None,
    async_client: Optional[AsyncHttpClient] = None,
    retry_config: Any = UNSET,
    timeout_ms: Optional[int] = None,
    debug_logger: Optional[Logger] = None,
    headless: bool = True,
    scraping_backend: Optional[ScrapingBackend] = None,
    async_scraping_backend: Optional[AsyncScrapingBackend] = None,
) -> None:
    """Initialize the GriddyDraftBuzz client.

    Args:
        draftbuzz_auth: Optional dictionary containing authentication
            information. DraftBuzz does not currently require auth, but
            this is available for future use.
        server_idx: Index of the server to use from the server list.
        server_url: Override the default server URL.
        url_params: Parameters to template into the server URL.
        client: Custom synchronous HTTP client (must implement HttpClient).
        async_client: Custom async HTTP client (must implement AsyncHttpClient).
        retry_config: Configuration for automatic request retries.
        timeout_ms: Request timeout in milliseconds.
        debug_logger: Custom logger for debug output.
        headless: Run the Playwright browser in headless mode
            (default ``True``). Ignored when a custom
            *scraping_backend* is provided.
        scraping_backend: A synchronous scraping backend that satisfies the
            :class:`~griddy.draftbuzz.backends.ScrapingBackend` protocol.
            When provided, overrides the default Playwright backend.
        async_scraping_backend: An asynchronous scraping backend that
            satisfies the :class:`~griddy.draftbuzz.backends.AsyncScrapingBackend`
            protocol.
    """
    # Pre-set so BaseSDK.__init__ can read via getattr
    self._headless = headless
    self._init_sdk(
        auth=draftbuzz_auth,
        server_idx=server_idx,
        server_url=server_url,
        url_params=url_params,
        client=client,
        async_client=async_client,
        retry_config=retry_config,
        timeout_ms=timeout_ms,
        debug_logger=debug_logger,
        scraping_backend=scraping_backend,
        async_scraping_backend=async_scraping_backend,
    )

SDKConfiguration dataclass

SDKConfiguration(
    client,
    client_supplied,
    async_client,
    async_client_supplied,
    debug_logger,
    security=None,
    server_url="",
    server_idx=0,
    language="python",
    sdk_version=__version__,
    user_agent=__user_agent__,
    retry_config=(lambda: UNSET)(),
    timeout_ms=None,
    server_type="default",
    scraping_backend=None,
    async_scraping_backend=None,
)

Bases: SDKConfiguration

DraftBuzz-specific SDK configuration with server URL resolution.

get_server_details

get_server_details()

Return the base URL and params for the configured server type.

Source code in src/griddy/draftbuzz/sdkconfiguration.py
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
    """Return the base URL and params for the configured server type."""
    if self.server_url is not None and self.server_url:
        return remove_suffix(self.server_url, "/"), {}

    server_url = SERVERS.get(self.server_type, SERVERS["default"])
    return server_url, {}