These are chat archives for django/django
Hi Pythonistas, I've got a small query,I am building a small api wrapper in python for the loklak project, I am using the
requests library to make a request to the server and retrieving an image response, How do i give this image as a response, the data is present in the request response
r.content from which I can write the data to a file to create the image, but in case this api is being used by someone else, is it right to return
r.content to the user ?
Here's a small snippet
import requests url = 'http://loklak.org/vis/markdown.png?text=hello%20world%0Dhello%20universe&color_text=000000&color_background=ffffff&padding=3' r = requests.get(url) # f = open('image.png','wb') # f.write(r.content) # f.close() return r.content
Any guidance would be really helpful. Thanks a lot :smile: