Skip to content

Python SDK for Enrichr — micro-toll utility API warehouse. pip install enrichr-sdk

Notifications You must be signed in to change notification settings

crisjonblvx/enrichr-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

enrichr-sdk

Python SDK for Enrichr — a micro-toll utility API warehouse. One API key. 40 endpoints. Fractions of a cent per call.

Install

pip install enrichr-sdk

Requires Python 3.10+ and httpx.

Quick start

from enrichr import Enrichr

client = Enrichr("enr_your_api_key")

# Validate an email
result = client.enrich.email("user@example.com")
print(result["data"]["valid"])          # True
print(result["data"]["disposable"])     # False
print(result["cost_usd"])              # 0.0001

# Generate a slug
slug = client.generate.slug("Hello World! Café & More")
print(slug["data"]["slug"])             # hello-world-cafe-more

# Validate a credit card (Luhn + network, number never stored)
card = client.validate.credit_card("4111 1111 1111 1111")
print(card["data"]["network"])          # Visa

# Convert units
result = client.convert.units(100, "km", "mi")
print(result["data"]["result"])         # 62.137...

Async

import asyncio
from enrichr import AsyncEnrichr

async def main():
    async with AsyncEnrichr("enr_your_api_key") as client:
        email = await client.enrich.email("user@example.com")
        slug  = await client.generate.slug("Hello World")
        ip    = await client.enrich.ip("8.8.8.8")
        print(ip["data"]["city"])       # Mountain View

asyncio.run(main())

All 40 endpoints

client.enrich

Method Description
.email(email) Validate email (format, MX, disposable)
.phone(phone, country_hint="US") Parse phone to E.164, detect line type
.address(street, city, ...) Normalize postal address
.ip(ip) Geolocate IP (country, city, ISP, timezone)
.classify(text) Sentiment, toxicity, spam, language

client.convert

Method Description
.currency(amount, from_currency, to_currency) ECB rates, updated daily
.timezone(datetime, from_tz, to_tz) DST-aware IANA timezone conversion
.units(value, from_unit, to_unit) Length, weight, temperature, area, volume
.number(value, from_base) decimal ↔ binary ↔ octal ↔ hex ↔ Roman
.case(text) camelCase, snake_case, PascalCase + 6 more
.html_to_text(html) Strip HTML tags
.markdown(markdown) Markdown → HTML
.encoding(text, codec, operation) base64, hex, url, html, rot13

client.validate

Method Description
.vat(vat_number) EU VAT — format + VIES check
.password(password) HIBP breach check + strength score
.credit_card(number) Luhn + network (Visa, MC, Amex, …)
.iban(iban) MOD-97 checksum, 77 countries
.json(json_string) Validate + format + analyze JSON
.color(color) hex/rgb/hsl conversion
.domain(domain) Format + DNS A + MX check
.regex(pattern, test_string) Test regex, return all matches
.uuid(uuid) Validate + detect version (v1–v5)

client.generate

Method Description
.qr(content) QR code → base64 PNG + data URI
.uuid(version=4, count=1) UUID v1 or v4, up to 100
.hash(text, algorithm="sha256") MD5/SHA-1/SHA-256/SHA-512
.password(length=16, ...) Secure random password + entropy
.slug(text) URL-safe slug (Unicode-aware)
.avatar(name) SVG initials avatar
.lorem(paragraphs=1) Lorem ipsum text
.token(length=32, style="hex") hex / url_safe / alphanumeric / api_key

client.analyze

Method Description
.text(text) Word count, reading time, Flesch readability

client.filter

Method Description
.profanity(text) Detect + censor profanity

client.lookup

Method Description
.postal(postal_code, country="US") City, state, coords (60+ countries)
.country(query) Country by ISO code or name
.timezone(timezone) IANA timezone info (offset, DST, abbr)
.mime_type(query) Extension → MIME or MIME → extensions

client.parse

Method Description
.url(url) Scheme, host, path, params, UTM tags
.user_agent(user_agent) Browser, OS, device, bot detection
.csv(csv_string) CSV string → structured rows
.date(date_string) Parse any date string

client.account

Method Description
.signup(email) Create an API key
.usage() Monthly call count + estimated charge

Error handling

from enrichr import Enrichr, EnrichrError

client = Enrichr("enr_your_key")
try:
    result = client.enrich.email("bad@example.com")
except EnrichrError as e:
    print(e.status_code, str(e))

Pricing

First 1,000 calls/month are free. After that:

  • Most utility endpoints: $0.00001/call (one-hundredth of a cent)
  • Enrichment endpoints: $0.0001/call
  • VAT, address: $0.0005/call

Full pricing at enrichrapi.dev.

License

MIT

About

Python SDK for Enrichr — micro-toll utility API warehouse. pip install enrichr-sdk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages