Spaces:
Runtime error
Runtime error
Commit
·
8c7f1c1
1
Parent(s):
9ee00e3
update congifenv
Browse files
TechdocsAPI/backend/__init__.py
CHANGED
|
@@ -12,8 +12,6 @@ from langchain.llms import Clarifai
|
|
| 12 |
from langchain.chains import LLMChain
|
| 13 |
from langchain.prompts import PromptTemplate
|
| 14 |
|
| 15 |
-
from fastapi_mail import ConnectionConfig, FastMail
|
| 16 |
-
|
| 17 |
app = FastAPI(title="Techdocs",
|
| 18 |
version="V0.0.1",
|
| 19 |
description="API for automatic code documentation generation!"
|
|
@@ -49,25 +47,6 @@ try:
|
|
| 49 |
app.state.templates = Jinja2Templates(directory="./backend/templates")
|
| 50 |
|
| 51 |
|
| 52 |
-
conf = ConnectionConfig(
|
| 53 |
-
MAIL_USERNAME=config.MAIL_USERNAME,
|
| 54 |
-
MAIL_PASSWORD=config.MAIL_PASSWORD,
|
| 55 |
-
MAIL_FROM=config.MAIL_FROM,
|
| 56 |
-
MAIL_PORT=2525,
|
| 57 |
-
MAIL_SERVER="smtp.caffienecrewhacks.tech",
|
| 58 |
-
MAIL_STARTTLS=True,
|
| 59 |
-
MAIL_SSL_TLS=False,
|
| 60 |
-
TEMPLATE_FOLDER="backend/templates",
|
| 61 |
-
USE_CREDENTIALS = True,
|
| 62 |
-
VALIDATE_CERTS = False
|
| 63 |
-
|
| 64 |
-
# MAIL_TLS=True,
|
| 65 |
-
# MAIL_SSL=False
|
| 66 |
-
)
|
| 67 |
-
|
| 68 |
-
app.state.mail_client = FastMail(conf)
|
| 69 |
-
|
| 70 |
-
|
| 71 |
|
| 72 |
except mysql.connector.Error as err:
|
| 73 |
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(err))
|
|
|
|
| 12 |
from langchain.chains import LLMChain
|
| 13 |
from langchain.prompts import PromptTemplate
|
| 14 |
|
|
|
|
|
|
|
| 15 |
app = FastAPI(title="Techdocs",
|
| 16 |
version="V0.0.1",
|
| 17 |
description="API for automatic code documentation generation!"
|
|
|
|
| 47 |
app.state.templates = Jinja2Templates(directory="./backend/templates")
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
except mysql.connector.Error as err:
|
| 52 |
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(err))
|
TechdocsAPI/backend/services/auth/ops.py
CHANGED
|
@@ -12,8 +12,6 @@ from fastapi import HTTPException, BackgroundTasks
|
|
| 12 |
from pydantic import ValidationError
|
| 13 |
from jose import jwt
|
| 14 |
|
| 15 |
-
from fastapi_mail import MessageSchema, MessageType
|
| 16 |
-
|
| 17 |
async def ops_signup(bgtasks: BackgroundTasks, response_result: GeneralResponse, data: UserAuth):
|
| 18 |
"""Wrapper method to handle signup process.
|
| 19 |
|
|
@@ -39,12 +37,6 @@ async def ops_signup(bgtasks: BackgroundTasks, response_result: GeneralResponse,
|
|
| 39 |
"verify_link": verification_link
|
| 40 |
}
|
| 41 |
|
| 42 |
-
# message = MessageSchema(
|
| 43 |
-
# subject="Welcome to Techdocs:[Account Verification]",
|
| 44 |
-
# recipients=[data.email], # List of recipients, as many as you can pass
|
| 45 |
-
# template_body=email_body_params,
|
| 46 |
-
# subtype=MessageType.html
|
| 47 |
-
# )
|
| 48 |
details = {
|
| 49 |
"recipients": [data.email],
|
| 50 |
"subject": "Welcome to Techdocs:[Account Verification]",
|
|
@@ -52,8 +44,6 @@ async def ops_signup(bgtasks: BackgroundTasks, response_result: GeneralResponse,
|
|
| 52 |
"template_kwargs": email_body_params
|
| 53 |
}
|
| 54 |
|
| 55 |
-
# await app.state.mail_client.send_message(message=message, template_name="email_verification.html")
|
| 56 |
-
|
| 57 |
status = post_request(url=config.MAIL_SERVER_URL, data=details, headers=None)
|
| 58 |
if status != 200:
|
| 59 |
raise EmailNotSentException()
|
|
|
|
| 12 |
from pydantic import ValidationError
|
| 13 |
from jose import jwt
|
| 14 |
|
|
|
|
|
|
|
| 15 |
async def ops_signup(bgtasks: BackgroundTasks, response_result: GeneralResponse, data: UserAuth):
|
| 16 |
"""Wrapper method to handle signup process.
|
| 17 |
|
|
|
|
| 37 |
"verify_link": verification_link
|
| 38 |
}
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
details = {
|
| 41 |
"recipients": [data.email],
|
| 42 |
"subject": "Welcome to Techdocs:[Account Verification]",
|
|
|
|
| 44 |
"template_kwargs": email_body_params
|
| 45 |
}
|
| 46 |
|
|
|
|
|
|
|
| 47 |
status = post_request(url=config.MAIL_SERVER_URL, data=details, headers=None)
|
| 48 |
if status != 200:
|
| 49 |
raise EmailNotSentException()
|
TechdocsAPI/requirements.txt
CHANGED
|
@@ -10,4 +10,3 @@ langchain
|
|
| 10 |
clarifai
|
| 11 |
Pillow
|
| 12 |
jinja2
|
| 13 |
-
fastapi-mail==1.3.1
|
|
|
|
| 10 |
clarifai
|
| 11 |
Pillow
|
| 12 |
jinja2
|
|
|