Options

6/30 maintenance broke uploads?

knykny Registered Users Posts: 33 Big grins
I am getting an error whenever I upload photos since the maintenance last night. My code is unchanged. This same script was working up until the maintenance window last night (in fact a mass upload was in progress when the site went down for maintenance).

The upload script is in python and the upload code looks like this, though I don't expect this to be of much help as this is unchanged and has been working fine but no longer:
API_KEY='sdfsdfsdfsdfsdfs'
API_VERSION='1.2.2'
API_URL='http://secure.smugmug.com/services/api/json/1.2.2/'
UPLOAD_URL='http://upload.smugmug.com/'

def safe_geturl(request) :
  try :
    response = urllib2.urlopen(request).read()
    result = json.loads(response)
    if result['stat'] != 'ok' : raise Exception('Bad result code')
  except :
    print "Error issuing request"
    print "Request was:"
    print "  " + str(request)
etc....

    data = open(filename, 'rb').read()
    upload_request = urllib2.Request(UPLOAD_URL,
                                       data,
                                       {'Content-Length'  : len(data),
                                        'Content-MD5'     : hashlib.md5(data).hexdigest(),
                                        'Content-type'     : 'none',
                                        'X-Smug-SessionID': session,
                                        'X-Smug-Version'  : API_VERSION,
                                        'X-Smug-ResponseType' : 'JSON',
                                        'X-Smug-AlbumID'  : album_id,
                                        'X-Smug-FileName' : filename,
                                        'X-Smug-Keywords' : keywords })
    safe_geturl(upload_request)

The http post clearly happens as my bandwidth spikes but then eventually the
response = urllib2.urlopen(request).read()
fails and I get an error
Error issuing request
Request was:
  <urllib2.Request instance at 0x1006280e0>

Comments

  • Options
    knykny Registered Users Posts: 33 Big grins
    edited July 1, 2011
    Script is working again. Magic!
Sign In or Register to comment.