Skip to main content

Official Python SDK for ARASE - AI-powered search engine API with stocks and weather

Project description

ARASE Python SDK

المكتبة الرسمية لـ ARASE - محرك البحث الذكي بالذكاء الاصطناعي.

Official Python SDK for ARASE - AI-powered search engine API.

Installation | التثبيت

pip install arase-sdk

Quick Start | البداية السريعة

Option 1: Environment Variable (Recommended) | الخيار 1: متغير البيئة (مستحسن)

# .env file | ملف .env
ARASE_API_KEY=arase_YOUR_API_KEY
from arase import AraseClient

# Automatically reads from ARASE_API_KEY environment variable
# يقرأ تلقائياً من متغير البيئة ARASE_API_KEY
client = AraseClient()

results = client.search("ما هي رؤية السعودية 2030؟")
print(results.answer)

Option 2: Direct API Key | الخيار 2: مفتاح API مباشر

from arase import AraseClient

client = AraseClient(api_key="arase_YOUR_API_KEY")

results = client.search("What is Saudi Vision 2030?")
print(results.answer)

Environment Variables | متغيرات البيئة

Variable Description الوصف
ARASE_API_KEY Your API key (required) مفتاح API الخاص بك (مطلوب)
ARASE_BASE_URL Custom API URL (optional) رابط API مخصص (اختياري)

Features | الميزات

Web Search | بحث الويب

results = client.search("أفضل المطاعم في الرياض", include_answer=True)

print(results.answer)   # AI-generated answer | إجابة AI
print(results.results)  # Web results | نتائج الويب

Image Search | بحث الصور

results = client.search_images("برج المملكة الرياض")
for image in results.images:
    print(image.image_url)

News Search | بحث الأخبار

results = client.search_news("أخبار السعودية اليوم")
for article in results.news:
    print(f"{article.title} - {article.source}")

Places Search | بحث الأماكن

# Search near Riyadh | البحث قرب الرياض
results = client.search_places(
    "مقاهي قريبة",
    user_location={"lat": 24.7136, "lng": 46.6753}
)
for place in results.places:
    print(f"{place.title} - {place.rating}⭐")

Academic Search | بحث أكاديمي

results = client.search_scholar("artificial intelligence")
for paper in results.scholar:
    print(f"{paper.title} ({paper.year}) - {paper.citations} citations")

Stock Market Search | بحث سوق الأسهم

# Basic stock search | بحث بسيط
stocks = client.search(
    "كم سعر سهم أرامكو؟",
    include_stocks=True,
)

if stocks.stocks:
    for stock in stocks.stocks.results:
        print(f"{stock.name}: {stock.price} {stock.currency}")
        print(f"Change: {stock.change_percent}%")

# With AI summary (+1 request) | مع ملخص AI (+1 طلب)
stocks_with_summary = client.search(
    "Compare Aramco vs Al Rajhi",
    include_stocks=True,
    options={
        "stocks": {
            "summary": True
        }
    },
)

print(stocks_with_summary.stocks.summary)

Weather Search | بحث الطقس

# Basic weather | طقس بسيط
weather = client.search(
    "الطقس في جدة",
    include_weather=True,
)

if weather.weather:
    location = weather.weather.location
    current = weather.weather.current
    print(f"{location['name']}: {current['temp_c']}°C, {current['condition']}")

    # Forecast | التوقعات
    for day in weather.weather.forecast:
        print(f"{day.date}: {day.mintemp_c}°C - {day.maxtemp_c}°C")

# With AI summary and advice (+1 request) | مع ملخص ونصائح AI
weather_with_summary = client.search(
    "Weather in Riyadh",
    include_weather=True,
    options={
        "weather": {
            "summary": True
        }
    },
)

print(weather_with_summary.weather.summary)
print(weather_with_summary.weather.advice)

Content Extraction | استخراج المحتوى

content = client.extract(
    "https://example.com/article",
    include_summary=True
)
print(content.content)
print(content.summary)

Advanced Options | خيارات متقدمة

from arase import AraseClient, SearchOptions

client = AraseClient()

# Using SearchOptions | استخدام SearchOptions
options = SearchOptions(
    search_depth="deep",      # basic | advanced | deep
    max_results=20,
    include_answer=True,
    include_images=True,
    include_videos=True,
    include_news=True,
    include_places=True,
    include_shopping=True,
    include_scholar=True,
    include_stocks=True,      # 🆕 Stock market data
    include_weather=True,     # 🆕 Weather forecasts
    topic="general",          # general | news | academic
    max_steps=3,              # For deep search | للبحث العميق

    # Optional AI summaries | ملخصات AI اختيارية
    options={
        "stocks": {
            "summary": True  # +1 request | +1 طلب
        },
        "weather": {
            "summary": True  # +1 request | +1 طلب
        },
    },
)

results = client.search("query", options=options)

# Or use keyword arguments | أو استخدم الكلمات المفتاحية
results = client.search(
    "query",
    include_answer=True,
    max_results=10,
)

Async Support | دعم Async

import asyncio
from arase import AsyncAraseClient

async def main():
    async with AsyncAraseClient() as client:
        results = await client.search("query", include_answer=True)
        print(results.answer)

asyncio.run(main())

Error Handling | معالجة الأخطاء

from arase import AraseClient, AraseAPIError

client = AraseClient()

try:
    results = client.search("query")
except AraseAPIError as e:
    print(f"Error {e.code}: {e.message}")
    print(f"Status: {e.status}")

Context Manager | مدير السياق

from arase import AraseClient

# Automatically closes connection | يغلق الاتصال تلقائياً
with AraseClient() as client:
    results = client.search("query")
    print(results.answer)

Type Hints | تلميحات الأنواع

Full type hints support for better IDE experience:

from arase import (
    AraseClient,
    SearchOptions,
    SearchResponse,
    SearchResult,
    ImageResult,
    StockResult,        # 🆕 New: Stock data types
    StocksResponse,     # 🆕 New: Stock response
    WeatherForecast,    # 🆕 New: Weather forecast
    WeatherResponse,    # 🆕 New: Weather response
    # ... etc
)

Links | روابط

License

MIT

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

arase_sdk-1.3.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

arase_sdk-1.3.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file arase_sdk-1.3.0.tar.gz.

File metadata

  • Download URL: arase_sdk-1.3.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for arase_sdk-1.3.0.tar.gz
Algorithm Hash digest
SHA256 7adc53476f3a9b6cff0b753d00637f5f5f9a5a973d140d47b6315fe753577b2a
MD5 6cdfd6abd2ef1a692c411825852b9baa
BLAKE2b-256 cf56f7daad77bb3343980d5430af1564e8a9934482e4a95187d0c6f6a571399e

See more details on using hashes here.

File details

Details for the file arase_sdk-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: arase_sdk-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for arase_sdk-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54d912ec9ff54d67b080c329022001024f098dbcc22a7cf8bf197e9d78aa3bf1
MD5 dcfcd86ec2bcd5b85781e885f13a7d24
BLAKE2b-256 580dac12a4bc66d593bc2519bc8861249298a2732b265cc81370664a96054092

See more details on using hashes here.

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