How to display images in html?
<p>I have a working app using the imgur API with python.</p>

<pre><code>from imgurpython import ImgurClient

client_id = '5b786edf274c63c'
client_secret = 'e44e529f76cb43769d7dc15eb47d45fc3836ff2f'

client = ImgurClient(client_id, client_secret)

items = client.subreddit_gallery('rarepuppers')
for item in items:
    print(item.link)
</code></pre>

<p>It outputs a set of imgur links. I want to display all those pictures on a webpage.</p>

<p>Does anyone know how I can integrate python to do that in an HTML page?</p>

<p>OK, I haven't tested this, but it should work.  The HTML is really basic (but you never mentioned anything about formatting) so give this a shot:</p>

<pre><code>from imgurpython import ImgurClient

client_id = '5b786edf274c63c'
client_secret = 'e44e529f76cb43769d7dc15eb47d45fc3836ff2f'

client = ImgurClient(client_id, client_secret)

items = client.subreddit_gallery('rarepuppers')

htmloutput = open('somename.html', 'w')
htmloutput.write("[html headers here]")
htmloutput.write("&lt;body&gt;")

for item in items:
    print(item.link)

    htmloutput.write('&lt;a href="' + item.link + '"&gt;SOME DESCRIPTION&lt;/a&gt;&lt;br&gt;')

htmloutput.write("&lt;/body&lt;/html&gt;")
htmloutput.close
</code></pre>

<p>You can remove the print(item.link) statement in the code above - it's there to give you some comfort that stuff is happening.</p>

<p>I've made a few assumptions:</p>

<ol>
<li>The item.link returns a string with only the unformatted link.  If it's already in html format, then remove the HTML around item.link in the example above.</li>
<li>You know how to add an HTML header.  Let me know if you do not.</li>
<li>This script will create the html file in the folder it's run from.  This is probably not the greatest of ideas.  So adjust the path of the created file appropriately.</li>
</ol>

<p><strong>Once again, though, if that is a real client secret, you probably want to change it ASAP.</strong></p>

python html api imgur