You use the app.yaml
file to tell App Engine which libraries and versions you want to use only for those Third-party libraries available at the platform.
In your case, you want to use a version of the library that is not available, so you can't use that method to configure it.
Instead of that, you can upload to App Engine the libraries you want to use by following the method outlined in this other question:
- To download the library and unzipped inside your GAE application directory. In this example, the destination directory is called
pycrypto26
.
- To include the path to that library with something like
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pycrypto26/lib'))
- To import the relevant modules
import Crypto
from Crypto.Hash import SHA256, SHA512
A full working example is
import webapp2
import logging
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pycrypto26/lib'))
import Crypto
from Crypto.Hash import SHA256, SHA512
class MainPage(webapp2.RequestHandler):
def get(self):
logging.info("Running PyCrypto with version %s" % Crypto.__version__)
self.response.write('<html><body>')
self.response.write( SHA256.new('abcd').hexdigest() + "<br>" )
self.response.write( SHA512.new('abcd').hexdigest() + "<br>")
self.response.write('</body></html>')
application = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)