0

I may be completely wrong here, because this is the first time I am working with cookies with python. I have a code snippet below from my api:

@app.route('/ids', methods=['GET'])
@cross_origin(origin='*',headers=['Content-Type','Authorization'])
def ids():
last = id.query.filter_by(last=True).first()
last.last = False
if last.id >= 10:
    newid = 1
    newIdSet = id.query.filter_by(id=newid).first()
    newIdSet.last = True
elif last.id < 10:
    newid = last.id + 1
    newIdSet = id.query.filter_by(id=newid).first()
    newIdSet.last = True

db.session.commit()
data = newid

resp = make_response()
resp.set_cookie('id', newid)

return resp

I have it set to return a response to the html page that is on another domain. I am wanting to set a cookie this way, is that at all possible? Thanks in advance.

0 Answers0