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
import pymongo.errors | |
# Retry decorator with exponential backoff | |
def retry(tries=5, delay=0.1, backoff=2): | |
"""Retries a function or method until it returns True. | |
delay sets the initial delay in seconds, and backoff sets the factor by which | |
the delay should lengthen after each failure. backoff must be greater than 1, | |
or else it isn't really a backoff. tries must be at least 0, and delay | |
greater than 0. |
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
import sys | |
import urllib2 | |
from json import loads | |
from urllib import urlencode | |
import base64 | |
print sys.argv | |
LOG_FILE = 'uploads.log' | |
DEV_KEY = 'YOUR KEY HERE' # from http://imgur.com/register/api_anon |