def test_npm_install_can_install_dependencies(self): npm_install(TEST_DIR) self.assertTrue(os.path.exists(PATH_TO_NODE_MODULES)) self.assertTrue(os.path.exists(PATH_TO_INSTALLED_PACKAGE))
# Setting the credentials aws_access_key = os.environ['AWS_ACCESS_KEY_ID'] aws_secret_access_key = os.environ['AWS_SECRET_ACCESS_KEY'] # Setting the AWS S3 and DynamoDB s3 = boto3.resource('s3', aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_access_key) dynamo = boto3.resource('dynamodb', region_name='us-east-2', aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_access_key) #jwt.register_algorithm('RS256', RSAAlgorithm(RSAAlgorithm.SHA256)) npm_install('app/pem') # AWS Cognito Access-token def is_token_valid(token): pems_dict = {'kid1': 'pem1', 'kid2': 'pem2'} kid = jwt.get_unverified_header(token)['kid'] pem = pems_dict.get(kid, None) if pem is None: print('kid false') return False try: decoded_token = jwt.decode(token, pem, algorithms=['RS256'])
from npm.bindings import npm_install # Install the dependencies in a directory containing a package.json npm_install('commapp/commapp/static')
import os import sys from npm.bindings import npm_install, npm_run wd = os.getcwd() dir = os.path.dirname(os.path.realpath(__file__)) npm_install('{}/mkpdfs_mkdocs/design'.format(dir)) os.chdir('{}/mkpdfs_mkdocs/design'.format(dir)) stderr, stdout = npm_run('run', 'build-css') if stderr : sys.exit(stderr) print(stdout) os.chdir(wd)