aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-03-27 21:57:15 -0400
committerBobby <[email protected]>2023-03-27 21:57:15 -0400
commit67860927fb1d2b350cc0ef3b3b832fa626edba78 (patch)
treed10abbaf4ef625f8c5869f9b8300e0a8b41f7876
parent95fe472609f83a8ba9616cd65569a4a0aea4bc0d (diff)
downloadthatcomputerscientist-67860927fb1d2b350cc0ef3b3b832fa626edba78.tar.xz
thatcomputerscientist-67860927fb1d2b350cc0ef3b3b832fa626edba78.zip
Socialify Error on unable to generate image
-rw-r--r--ignis/views.py14
-rw-r--r--static/images/site/utgi.gifbin0 -> 39533 bytes
2 files changed, 11 insertions, 3 deletions
diff --git a/ignis/views.py b/ignis/views.py
index dbf01212..0f3d6a3c 100644
--- a/ignis/views.py
+++ b/ignis/views.py
@@ -224,6 +224,14 @@ def socialify(request):
url = 'https://socialify.thatcomputerscientist.com/{}/png?description={}&font={}&forks={}&issues={}&language={}&language2={}&name={}&owner=1&pattern={}&pulls={}&stargazers={}&theme={}'.format(repo, description, font, forks, issues, language_1, language_2, name, pattern, pulls, stargazers, theme)
- print(url)
- image = requests.get(url).content
- return HttpResponse(image, content_type='image/png')
+ req = requests.get(url)
+ image = req.content
+ status = req.status_code
+
+ if status == 200:
+ return HttpResponse(image, content_type='image/png')
+ else:
+ with open('static/images/site/utgi.gif', 'rb') as f:
+ image = f.read()
+ return HttpResponse(image, content_type='image/gif')
+
diff --git a/static/images/site/utgi.gif b/static/images/site/utgi.gif
new file mode 100644
index 00000000..3e9f4097
--- /dev/null
+++ b/static/images/site/utgi.gif
Binary files differ