Skip to main content

Python library for getting a list of details regarding the Bulgarian State Gazette (Държавен вестник) issues

Project description

📰 Vestige

A Python library for fetching and parsing issues of the Bulgarian State Gazette (Държавен вестник).

Vestige gives you a clean, dependency-light Python interface to the official Държавен вестник listing. Scrape issue metadata and download links without wrestling with raw HTML or cryptic JSF form fields ever again.

✨ Features

  • 📄 Issue Listings: Fetch paginated lists of State Gazette issues, including issue number, date, year, and type.
  • 📥 Download Links: Automatically resolve the PDF and RTF download URLs for each issue.
  • 🔌 Pluggable Architecture: Swap out the HTTP transport or the HTML parser via simple interfaces — great for testing with mocks.
  • 🗂️ Typed Models: Clean dataclasses (IssueEntry, DownloadFile, PageResult) with to_dict() helpers for easy JSON serialization.
  • ⚡ Minimal Dependencies: Only needs selectolax and httpx[http2].

📥 Installation

pip install vestige-scraper

Or, to install directly from source:

pip install .

🚀 Quick Start

import asyncio
from vestige import DVClient

async def main():
    client = DVClient()
    try:
        # Fetch the first page of issues (with download URLs resolved)
        page = await client.get_page(1)

        print(page)
        # PageResult(page=1, total_results=..., total_pages=..., entries=...)

        for entry in page.entries:
            print(entry)
            for file in entry.download_urls:
                print(f"  → {file.filename}: {file.url}")
    finally:
        await client.aclose()

asyncio.run(main())

Fetch all pages at once

import asyncio
from vestige import DVClient

async def main():
    client = DVClient()
    try:
        all_pages = await client.get_all_pages(max_pages=5)
        for page in all_pages:
            for entry in page.entries:
                print(entry.to_dict())
    finally:
        await client.aclose()

asyncio.run(main())

Skip download URL resolution (faster)

page = client.get_page(1, fetch_downloads=False)

🗂️ Models

Class Description
IssueEntry One issue of the State Gazette — number, date, year, type, and download files.
DownloadFile A single downloadable file (url, filename).
PageResult One page of results — holds metadata and a list of IssueEntry objects.

⚙️ Advanced Usage

Custom transport / parser (e.g. for testing)

from vestige import DVClient
from vestige.network.transport import AsyncRequestsTransport
from vestige.scraping.parsers import IssueParser

client = DVClient(
    transport=MyCustomTransport(),
    parser=MyCustomParser(),
)

Both transport and parser accept any object that satisfies the AsyncPageFetcher and PageParser interfaces defined in vestige.core.interfaces.

🐍 Requirements

  • Python 3.10+
  • asyncio>=4.0.0
  • selectolax>=0.4.7
  • httpx[http2]>=0.28.1

🤝 Contributing

Issues and pull requests are welcome! Please file an issue if you encounter any problems or have suggestions for improvements.


Built with ❤️ for Bulgaria's open data. MIT Licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vestige_scraper-1.1.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vestige_scraper-1.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file vestige_scraper-1.1.0.tar.gz.

File metadata

  • Download URL: vestige_scraper-1.1.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vestige_scraper-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3329d9926a17ee0cb451536088d818bb064df25f44dad2c97a785458407234a3
MD5 663bb16d6c0e3c16196c3754adc23076
BLAKE2b-256 f7fb196e584c8a913469bc9bef1def8d97750ccb846370a000081def14010ade

See more details on using hashes here.

Provenance

The following attestation bundles were made for vestige_scraper-1.1.0.tar.gz:

Publisher: publish.yml on ytcalifax/vestige

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vestige_scraper-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vestige_scraper-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09a985f7b38e18eec872ede90b941811be18d33494f44b864ab00fa18557fd12
MD5 a3f5b854e4c06d3f1591099272c888a8
BLAKE2b-256 2614c730a0086e8937f446a706730f0ee857140d5d665adb7ddfc58060384768

See more details on using hashes here.

Provenance

The following attestation bundles were made for vestige_scraper-1.1.0-py3-none-any.whl:

Publisher: publish.yml on ytcalifax/vestige

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page