webapi where you can request scheduled rss feed publishing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
590 B

from datetime import datetime
from app import db
from models.postmodel import Post
from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError,
InterfaceError, InvalidRequestError)
def schedule_text(request):
print(request.form["text"])
try:
post = Post(
content=request.form["text"],
last_updated=datetime.now(),
scheduled_time=datetime.now(),
)
db.session.add(post)
db.session.commit()
except DatabaseError:
db.session.rollback()
return "post scheduled"