Python relative imports in AWS Lambda fail with attempted relative import with no known parent package
In AWS Lambda if I attempt an explicit relative import like this
.
├── lambda_file.py
└── example.py
# | |
# a one-liner to get raw content from github enterprise, relying on basic authentication. | |
# eliminates the need to create an access token and incorporate it in the url. | |
# | |
# | |
# fill in the blanks: | |
# | |
# USER your login user name for authentication (you'll be prompted for password on the terminal) | |
# GHE_DOMAIN the github enterprise custom domain |
#!/usr/bin/env python3 | |
import inspect | |
import argparse | |
import fire | |
from docstring_parser import parse | |
from prompt_toolkit.completion import Completer, Completion, FuzzyCompleter | |
from prompt_toolkit import PromptSession | |
from search.lsgrep import SearchFiles |
[package] | |
name = "bench-translate" | |
version = "0.1.0" | |
authors = ["colin <[email protected]>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
serde_json = "1.0.53" |
Both things have been introduced recently, and let you access even private ec2 instances
# Assumes valid AWS Credentials in ENV
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
.When run on a box, outputs a single row of JSON for every proc on the box that loads a jar
/war
that contains any files with 'log4j'
in them, including precisely what triggered the match. For example (pretty printed here for clarity; note that this one is happily a false positive):
{
"node": "HW0000001",
"time": 1632617610.3860812,
"pid": 78676,
"cmd": "/usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home/bin/java",
"args": [
"-Xms128M",
/* Ultra lightweight Github REST Client */ | |
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
const token = 'github-token-here' | |
const githubClient = generateAPI('https://api.github.com', { | |
headers: { | |
'User-Agent': 'xyz', | |
'Authorization': `bearer ${token}` | |
} | |
}) |
# We've been trying to figure out how to run async code from | |
# Celery until it gets support for it | |
# | |
# This is an extracted example which should fit into | |
# https://github.com/anomaly/lab-python-server | |
import asyncio | |
from uuid import UUID | |
from sqlalchemy.ext.asyncio import AsyncSession | |
from ...celery import app |