Health Predictions API - Python/Flask Integration

Health analysis and remedies based on planetary positions

Overview

Health analysis and remedies based on planetary positions

POST /api/v1/astrology/query
Pricing: $0.15 per request | Framework: Python/Flask | Auth: API Key required

Quick Start

1. Installation

pip install requests flask python-dotenv

2. Environment Setup

# .env
VEDIKA_API_KEY=your_api_key_here
Security: Never commit API keys to version control. Always use environment variables.

Complete Implementation

# health_prediction.py
import os
import requests
from flask import Blueprint, request, jsonify
from dotenv import load_dotenv

load_dotenv()

health_prediction_bp = Blueprint('health_prediction', __name__)

VEDIKA_BASE_URL = 'https://vedika-api-854222120654.us-central1.run.app'
VEDIKA_API_KEY = os.getenv('VEDIKA_API_KEY')

def get_health_prediction(params):
    """
    Health analysis and remedies based on planetary positions
    """
    headers = {
        'Content-Type': 'application/json',
        'x-api-key': VEDIKA_API_KEY
    }

    try:
        response = requests.post(
            f'{VEDIKA_BASE_URL}/api/v1/astrology/query',
            json=params,
            headers=headers,
            timeout=10
        )
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        raise Exception(f'Vedika API Error: {str(e)}')

@health_prediction_bp.route('/health-prediction', methods=['POST'])
def health_prediction_route():
    """
    Flask route for Health Predictions
    """
    try:
        data = request.get_json()
        result = get_health_prediction(data)
        return jsonify(result), 200
    except Exception as e:
        return jsonify({'error': str(e)}), 500

# app.py usage:
# from health_prediction import health_prediction_bp
# app.register_blueprint(health_prediction_bp, url_prefix='/api')

Request Parameters

Parameter Type Required Description
question varies Yes See API documentation
birthDetails varies Yes See API documentation

Error Handling

Status Code Error Solution
400 Bad Request Check request parameters and format
401 Unauthorized Verify API key is correct
402 Payment Required Insufficient balance - recharge at console.vedika.io
429 Rate Limit Exceeded Implement exponential backoff or upgrade plan
500 Server Error Retry after a few seconds

Best Practices

Response Format

{
  "success": true,
  "data": {
    // Endpoint-specific response data
  },
  "timestamp": "2026-01-07T10:30:00Z",
  "cost": 0.15
}

Related Endpoints

Birth Chart Kundli Match Panchang Dasha Periods Dosha Analysis

Other Frameworks

React Next.js Vue.js Angular Node.js Django Ruby on Rails

Support

Need help integrating this endpoint?