Python SDK Official Python SDK for the RankParse API. Sync and async clients, single dependency (httpx).
Requires Python 3.9+. Single runtime dependency: httpx.
from rankparse import RankParseClient
client = RankParseClient( api_key = "rp_..." )
result = client.domain_authority( "github.com" )
print (result[ "data" ][ "score" ]) # 94
print (result[ "credits_remaining" ]) # 9995
import asyncio
from rankparse import AsyncRankParseClient
async def main ():
async with AsyncRankParseClient( api_key = "rp_..." ) as client:
result = await client.domain_authority( "github.com" )
print (result[ "data" ][ "score" ])
asyncio.run(main())
from rankparse import RankParseClient
client = RankParseClient(
api_key = "rp_..." ,
base_url = "https://api.rankparse.com/v1" , # optional override
timeout = 30.0 , # seconds, default 30
)
# Sync
with RankParseClient( api_key = "rp_..." ) as client:
result = client.backlinks( "example.com" )
# Async
async with AsyncRankParseClient( api_key = "rp_..." ) as client:
result = await client.backlinks( "example.com" )
from rankparse.errors import AuthError, InsufficientCreditsError, RateLimitError
try :
result = client.backlinks( "example.com" )
except AuthError:
print ( "Invalid API key" )
except InsufficientCreditsError:
print ( "Top up at rankparse.com/dashboard" )
except RateLimitError:
print ( "Back off and retry" )
Method Endpoint Credits backlinks(domain, *, limit, offset, sort, from_domain, link_type)GET /backlinks2 referring_domains(domain, *, limit, offset)GET /referring-domains2 outbound_links(domain, *, limit)GET /outbound-links2 anchor_text(domain, *, limit)GET /anchor-text2 link_intersect(domain_a, domain_b, *, limit)GET /link-intersect5 link_velocity(domain)GET /link-velocity0 (v2) new_links(domain)GET /new-links0 (v2) lost_links(domain)GET /lost-links0 (v2)
Method Endpoint Credits domain_authority(domain)GET /domain-authority1 domain_rank(domain)GET /domain-rank2 domain_overlap(domains, *, limit)GET /domain-overlap5 similar_domains(domain, *, limit)GET /similar-domains5 competitor_gap(domain, vs, *, limit)GET /competitor-gap5 link_audit(domain)GET /link-audit8 site_explorer(domain, *, limit)GET /site-explorer10
Method Endpoint Credits page_seo(url)GET /page-seo3 page_performance(url, *, strategy)GET /page-performance3 tech_stack(url)GET /tech-stack2 site_health(domain)GET /site-health2 sitemap(domain)GET /sitemap2 crawl_history(domain, *, limit, offset)GET /crawl-history2 top_pages(domain, *, limit)GET /top-pages2 schema_markup(url)GET /schema-markup0 (v2) internal_links(url, *, limit, offset)GET /internal-links0 (v2)
Method Description batch(requests)Run up to 50 requests in one call me()Current user profile + credit balance credits()Credit balance keys()List API keys create_key(name)Create a new API key revoke_key(key_id)Revoke an API key usage(*, limit, offset)Paginated usage logs
page1 = client.backlinks( "example.com" , limit = 100 , offset = 0 )
page2 = client.backlinks( "example.com" , limit = 100 , offset = 100 )
results = client.batch([
{ "endpoint" : "domain-authority" , "domain" : "stripe.com" },
{ "endpoint" : "domain-authority" , "domain" : "github.com" },
{ "endpoint" : "backlinks" , "domain" : "vercel.com" , "limit" : 10 },
])
import pandas as pd
from rankparse import RankParseClient
client = RankParseClient( api_key = "rp_..." )
df = pd.read_csv( "domains.csv" )
df[ "score" ] = df[ "domain" ].apply(
lambda d: client.domain_authority(d)[ "data" ][ "score" ]
)
df.sort_values( "score" , ascending = False ).to_csv( "enriched.csv" )
GitHub: abhibavishi/rankparse-python