When I try to use boto library on App Engine, I get the next error:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py", line 701, in __call__
handler.get(*groups)
File "E:\Probes\pruebas\pruebasAWS\main.py", line 26, in get
conn = S3Connection('<KEY1>','<KEY2>')
File "E:\Probes\pruebas\pruebasAWS\boto\s3\connection.py", line 148, in __init__
path=path, provider=provider)
File "E:\Probes\pruebas\pruebasAWS\boto\connection.py", line 231, in __init__
self.http_unretryable_exceptions.append(ssl.SSLError)
AttributeError: 'module' object has no attribute 'SSLError'
I´ve installed OpenSSL and Python 2.7. OpenSSL and SSL library for python are running, and when i deploy the App to the Google Infrastructure, it works fine. The problem comes when I try to execute the app on my local machine.
The code is:
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from boto.s3.connection import S3Connection
import hashlib
class MainHandler(webapp.RequestHandler):
def get(self):
conn = S3Connection('<KEY1>','<KEY2>')
bucket = conn.create_bucket(hashlib.md5('noTRePeaTedBuCket').hexdigest()+"probe")
if bucket:
self.response.out.write('Bucket creado')
else:
self.response.out.write('Bucket NO creado')
The actual issue here is that AppEngine mucks around with things to make it impossible to import certain standard, builtin python modules such as ssl.
There was some conversation about this on the boto IRC and one of the users came up with this patch:
https://github.com/samba/boto/commit/6f1ab73d92ff6fb2589362bbdadf6bbe66811e7e
Some form of this will probably be merged into boto master soon.