Skip to content

Releases: ahrefs/ahrefs-python

v0.3.1-alpha

20 Feb 10:47

Choose a tag to compare

v0.3.1-alpha Pre-release
Pre-release

What's New

  • 3 new Brand Radar endpoints: brand_radar_sov_history(), brand_radar_cited_domains(), brand_radar_cited_pages()
  • 52 endpoints total (was 49)

Example

from ahrefs import AhrefsClient

# Uses AHREFS_API_KEY environment variable
client = AhrefsClient()
data = client.brand_radar_cited_domains(
    select="domain,responses",
    data_source="chatgpt",
    brand="ahrefs",
    limit=5,
)
for item in data:
    print(f"{item.domain}: {item.responses} responses")
client.close()

v0.3.0-alpha

20 Feb 10:05

Choose a tag to compare

v0.3.0-alpha Pre-release
Pre-release

What's New

  • Batch Analysis endpoint — new batch_analysis() method for the Batch Analysis POST API
  • POST request support — sync and async clients now support POST endpoints with JSON request bodies
  • New typesBatchAnalysisRequest, BatchAnalysisTarget, BatchAnalysisData

Example

from ahrefs import AhrefsClient
from ahrefs.types import BatchAnalysisTarget

# Uses AHREFS_API_KEY environment variable
client = AhrefsClient()
data = client.batch_analysis(
    select=["ahrefs_rank", "domain_rating"],
    targets=[
        BatchAnalysisTarget(url="https://ahrefs.com", mode="domain", protocol="both"),
    ],
)
for item in data:
    print(f"DR {item.domain_rating}, Rank {item.ahrefs_rank}")
client.close()

Return Data directly from client methods

19 Feb 10:14

Choose a tag to compare

Changed

  • BREAKING: Client methods now return Data objects directly instead of Response wrappers
    • Scalar endpoints: Data | None (e.g. SiteExplorerDomainRatingData | None)
    • List endpoints: list[Data] (e.g. list[SiteExplorerOrganicKeywordsData])
  • Response classes removed from ahrefs.types public exports

Migration

# Before (v0.1.0)
response = client.site_explorer_domain_rating(target="ahrefs.com", date="2025-01-15")
print(response.data.domain_rating)

# After (v0.2.0)
data = client.site_explorer_domain_rating(target="ahrefs.com", date="2025-01-15")
print(data.domain_rating)

Initial pre-release of the Ahrefs Python SDK

14 Feb 04:31

Choose a tag to compare

Initial pre-release of the Ahrefs Python SDK