I've got a Python (Wep2py) web app that generates QR codes using the Google chart API. The app displays the QR code on the screen, and I want to offer a link to download it. Considering the images are not on my server, what are my options?
Example image url:
https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=Hello%20world
EDIT:
I've seen mention of using the header Content-disposition: attachment; to force a download dialog. Does anyone know if this header can be applied to external resources?
Download QR code here
Edit: If the browser of your user is able to handle the mimetype Google sends for the image, the browser will handle it. There is not much you can do about this which is a Good ThingTM.
Related
I have found a very nice algorithm for image classification (https://everypixel.com/aesthetics) and was wondering if its possible to upload image files to the webpage with python. They are using a drag and drop system for the image files. Because the algorithm tags those uploaded pictures, the possibility of automatic upload would be very nice.
Python is just a language and not a framework. This means it is not sufficient to be a web server(something that will accept a request and respond to it).
So you need to use a server like flask to accept the request and implement your algorithm there.To attach a file you need to implement a frontend as well.
I am sending html email with several images in it. My project is written in Python and Django and invokes web service to send the email(I can pass to the web service the html and attachments). The web service is in other part of the project and is implemented in Java and uses Amazon SES.
Which is the best approach for the html images?
To store them on my web server and link them with absolute URLs or to send the images as attachments and embed them in the html?
Do all email clients support absolute URLs for images?
I would suggest attaching images for clarity, but if you really want to save on used bandwidth and send lots of emails, it's better to send the URL..... If you are sure it won't change.
I have a python program that draws a physical network topology from gns3 using CDP and saves it after every 1 minute as a .png image file. I'm wondering if there is a way to post that image in a some kind of web-server so that I would be able to access it remotly with browser. Thank you
If the web server is running locally, all you need is to save it to the right directory.
If you have a web space somewhere, you can use FTP for uploading as described for example in this previous question.
You can also upload it directly to some image hosting web service, where you could then use their UI to nicely browse, categorize or delete the images as required -- you could look at some open source image uploading script like uimge for inspiration.
Can python upload images onto the internet and provide a URL for it? For example is it possible for python to upload an image onto photobucket or any other uploading image service and then retreive the URL for it?
Certainly. You'll need to find an image hosting service with an API (hint: Flickr), and then write some Python code to interact with it (hint: XML-RPC).
Pseudocode
import xmlrpclib
with open( "..." ) as imagelist:
for image in imagelist:
message = xmlrpclib.make_some_message_or_other
response = message.send( )
response.parse( )
You'll need a more specific question if you want a more specific answer!
Sure!
To do it, you basically have to have Python pretend to be a web browser. You need to go get the upload form, fill in all the fields, and pick your image. Then you need to submit the form data, uploading the image. Once that's done, you need to get the "upload complete" page from the site, and find the URL where the image went.
A good library to start with might be the Python version of Perl's famous WWW::Mechanize module. The library is basically a programmable Web browser that you can script in Python.
EDIT: If you plan to do this a lot, you probably do want to use an actual supported API. Otherwise the image hoster might get mad that your python bot is spamming their site.
There is a thread discussing Darwin notifications being sent after a screenshot is taken. Does this apply to websites viewed via Safari? Do the same restrictions apply to PC sytems? Would taking the picture via a Python script in Linux or running Safari in a VM circumvent detection?
if you are talking about this thread, please note that it seems to apply only to the iPhone. there is nothing similar in any decent web browser on any desktop platform (plus, anybody can put a proxy to filter this kind of notification, or create its own browser out of off-the-shelf components).
note that rendering a webpage in a browser is the same as taking a screenshot: the browser needs to know what to render on the screen and how to draw it. this is the purpose of HTML and CSS, to describe what and how to render a page, so the simple fact of downloading the content of a webpage gives enough informations for rendering into whatever you want, be it a screen, a picture saved or a file on disk.