sneed
This commit is contained in:
parent
7cb3f0f01c
commit
1acfc5c4c8
1 changed files with 17 additions and 16 deletions
|
@ -25,24 +25,25 @@ with open("snappy.txt", "r") as f:
|
|||
@app.route("/resize")
|
||||
def resize():
|
||||
u = g.db.query(User).filter(User.profileurl != None, User.resized != True).first()
|
||||
print(u.username)
|
||||
print(f"1 {u.profileurl}")
|
||||
x = requests.get(u.profileurl)
|
||||
if u:
|
||||
print(u.username)
|
||||
print(f"1 {u.profileurl}")
|
||||
x = requests.get(u.profileurl)
|
||||
|
||||
with open("resizing", "wb") as file:
|
||||
for chunk in x.iter_content(1024):
|
||||
file.write(chunk)
|
||||
with open("resizing", "wb") as file:
|
||||
for chunk in x.iter_content(1024):
|
||||
file.write(chunk)
|
||||
|
||||
image = upload_from_file("resizing", "resizing", (100, 100))
|
||||
if image == None:
|
||||
send_notification(1, u, "fail!")
|
||||
u.resized = True
|
||||
g.db.add(u)
|
||||
else:
|
||||
u.profileurl = image
|
||||
u.resized = True
|
||||
g.db.add(u)
|
||||
print(f"2 {u.profileurl}")
|
||||
image = upload_from_file("resizing", "resizing", (100, 100))
|
||||
if image == None:
|
||||
send_notification(1, u, "fail!")
|
||||
u.resized = True
|
||||
g.db.add(u)
|
||||
else:
|
||||
u.profileurl = image
|
||||
u.resized = True
|
||||
g.db.add(u)
|
||||
print(f"2 {u.profileurl}")
|
||||
|
||||
@app.route("/banaward/post/<post_id>")
|
||||
@auth_required
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue