Spaces:
Sleeping
Sleeping
| import requests | |
| import json | |
| def test_blog_generation(): | |
| try: | |
| # Add timeout of 300 seconds (5 minutes) | |
| response = requests.post('http://localhost:5001/generate-blog', timeout=300) | |
| if response.status_code == 200: | |
| data = response.json() | |
| print("Blog Generation Successful!") | |
| print("\nTitle:", data['data']['title']) | |
| print("\nSlug:", data['data']['slug']) | |
| print("\nMeta Description:", data['data']['meta_description']) | |
| print("\nKeywords:", data['data']['keywords']) | |
| print("\nPrimary Keyword:", data['data']['primary_keyword']) | |
| print("\nCover Image URL:", data['data']['cover_image']) | |
| print("\nDetailed Plan:", data['data']['detailed_plan']) | |
| print("\nResearch:", data['data']['research']) | |
| print("\nContent Preview:", data['data']['content'][:500] + "...") | |
| else: | |
| print("Error:", response.json()['error']) | |
| except requests.exceptions.Timeout: | |
| print("Request timed out after 5 minutes") | |
| except Exception as e: | |
| print(f"Error: {e}") | |
| if __name__ == "__main__": | |
| test_blog_generation() |