Created
January 8, 2012 20:27
-
-
Save cgutierrez/1579557 to your computer and use it in GitHub Desktop.
Save Hi-Res QR codes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zope.testbrowser.browser import Browser | |
from time import sleep | |
storyIds = range(1, 201) | |
rootUrl = "http://example.com/%s" | |
for storyId in storyIds: | |
url = rootUrl % (storyId) | |
browser = Browser("http://qrickit.com/qrickit_apps/qrickit_qrcode_creator_url.php") | |
qrForm = browser.getForm(action = "qrickit_qrcode_creator_url_output.php") | |
# populate the url field | |
urlInput = qrForm.getControl(name = "url") | |
urlInput.value = url | |
qrForm.submit(name = "submit") | |
# submit the high res form to get the image | |
qrHighResForm = browser.getForm(name = "form2") | |
qrHighResForm.submit(name = "submit2") | |
f = open("img/%s.jpg" % (storyId), "wb") | |
f.write(browser.contents) | |
f.close() | |
# try not to get rate limited | |
sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment