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.
Related
I'm working on a personal web crawler project where I want it to be able to send emails as notifications with an image inside the body of an email. I see plenty of documentation on how to download and then display an image using smtplib. However, I do not see any examples of displaying an image without downloading it.
I was wondering if it's possible to display an image inside the body of an smtplib email using only the image URL without needing to download the image. (You can use an image URL to put an image in an email body using gmail, so I was assuming it might be possible via automated python script.)
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.
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.
I am writing a image scraper using Pycurl by sending forged requests which is the same with the results by the http analyzer to the website server. Using the http analyzer
This site requires several steps of interaction to finally response with image contents. First I have to open the link by pycurl and get the gzip format response which including the html content. The request for image is then send by the site's javascript code.The server generated the image by a dll according to the reqeust.
I can already get the images by identifying the response content. However I found it very trivial that I have to change my code every time the website change the querying steps so I want to interact with this website by PyQt4.WebKit as a browser.
How to extract the specific image content in PyQt4.WebKit?
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.