Spaces:
Sleeping
Sleeping
from fastapi import FastAPI, HTTPException,Query,Request,BackgroundTasks | |
import json | |
from authenticate import get_access_token,get_access_token_v1 | |
import os | |
import requests | |
from extract_and_store_supabase import extract_structure_store_message | |
app = FastAPI() | |
async def process_document_base64(request: Request): | |
request_data = await request.json() | |
# print(request_data) | |
if request_data.get('user_id') and request_data.get('message_id') and request_data.get('attachment_id') is None: | |
return {"error":"attachment not present"} | |
user_id = request_data.get('user_id') | |
message_id = request_data.get('message_id') | |
attachment_id = request_data.get('attachment_id') | |
attachment_extension = request_data.get('attachment_extension') | |
email = request_data.get('email') | |
print("printing user_id") | |
print(user_id) | |
print("printing message_id") | |
print(email) | |
# background_tasks.add_task(extract_structure_store_message,user_id,message_id,attachment_id,attachment_extension,email) | |
data = await extract_structure_store_message(user_id,message_id,attachment_id,attachment_extension,email) | |
print("printing data") | |
print(data) | |
return {"data":data} |