These are chat archives for django/django

29th
Nov 2015
Johannes Hoppe
@codingjoe
Nov 29 2015 00:19
@sudheesh001 why do you serve the image from the source? BTW there is an example in the requests docs about binary responses. It is actually about images. Should be to hard to find.
Sudheesh Singanamalla
@sudheesh001
Nov 29 2015 04:18

@codingjoe So, the server internally responds to the API query with an image, and the python api to access the server returns the image data as mentioned, converting it to an image using PIL and sending an image object as a response is one option, but is this the recommended way to returning image responses via an API to the developer using the API ? or should I just be returning the binary data content which I am doing as of now and leave the overhead of converting it to an image to the developer ?

I do not want to increase the requirements for the library to be setup and using PIL just for converting it to an image object seems like an overkill in this situation. I hope my question is much more clear now. Thanks for the link as reference.

Johannes Hoppe
@codingjoe
Nov 29 2015 09:35
I don't see an issue there, tho I thought you wanted to save the image. Anyways, Django HttpResponse uses bytes anyways. Just create a new response use the content and don't forget to copy the header. Should be fine. Btw, I don't get why you need to relay the image anyways. Why not just response an 302 to the image.
Sudheesh Singanamalla
@sudheesh001
Nov 29 2015 10:52
I actually want to take this image and send it to the telegram client. But yeah I think i'll send the information of the complete response object with headers through the api. Thanks a lot @codingjoe
Johannes Hoppe
@codingjoe
Nov 29 2015 10:57
@sudheesh001 no problem. Your welcome.
Nathan Kirui
@Nkirui
Nov 29 2015 17:11
finding it hard to intergrate django with python
Johannes Hoppe
@codingjoe
Nov 29 2015 17:14
@Nkirui who do we have to understand this? I can tell you it’s easier than integrating it in C# ;)
Ikhsan Noor Rosyidin
@essanpupil
Nov 29 2015 22:38
Django is Python ,right?
Alexandr Ignatiev
@ErgNoor
Nov 29 2015 22:40
@essanpupil django is django, python is python :) python is programming language and django is web-framework written on python
Ikhsan Noor Rosyidin
@essanpupil
Nov 29 2015 22:43
@ErgNoor Well, in that case, we don't need to integrate django with python, do we? :)
Alexandr Ignatiev
@ErgNoor
Nov 29 2015 22:46
@essanpupil sorry, i'm not sure i got you. but you have to use python to install django and for development with django
Ikhsan Noor Rosyidin
@essanpupil
Nov 29 2015 22:51
I'm just trying to give simple answer for @Nkirui's question. We don't need to to integrate django with python because django is already integrated with python, not as a built-int library of course.
Alexandr Ignatiev
@ErgNoor
Nov 29 2015 22:53
@essanpupil ah, yeah. you're right. sorry, i just missed that question =D
Ikhsan Noor Rosyidin
@essanpupil
Nov 29 2015 22:56
no worries :)