Releases: ahrefs/ahrefs-python
Releases · ahrefs/ahrefs-python
v0.3.1-alpha
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
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 types —
BatchAnalysisRequest,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
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])
- Scalar endpoints:
- Response classes removed from
ahrefs.typespublic 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
Initial pre-release of the Ahrefs Python SDK