remotes/1693045480750635534/spooky-22
Aevann1 2021-07-24 13:43:58 +02:00
parent c3f7383c93
commit fc3d6ac553
2 changed files with 6 additions and 1 deletions

View File

@ -421,7 +421,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
elif self.url:
if v and not v.oldreddit: return self.url.replace("old.reddit.com", "reddit.com")
if self.url: return self.url
return ""
return ""
@property
def body(self):

View File

@ -68,6 +68,8 @@ def upload_file(name, file, resize=None):
print(e)
print(req)
print(req.text)
return
else:
req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {imgurkey}"}, data = {'image': base64.b64encode(file.read())})
try: resp = req.json()['data']
@ -75,11 +77,14 @@ def upload_file(name, file, resize=None):
print(e)
print(req)
print(req.text)
return
try: url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg") + "?maxwidth=9999"
except Exception as e:
print(e)
print(req)
print(req.text)
return
new_image = Image(
text=url,