Created
October 25, 2018 11:04
-
-
Save tavin/06bafc563dc7b82baa7c133b3ae48085 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 base64 import b64encode | |
from subprocess import check_call | |
from subprocess import check_output | |
from tempfile import mkdtemp | |
def lambda_handler(_event, _context): | |
tmp = mkdtemp(dir='/tmp') | |
check_call(['pip', 'install', 'psycopg2', '--target', tmp]) | |
tar = check_output(['tar', '-C', tmp, '-cz', '.']) | |
return str(b64encode(tar), 'ascii') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment