🏴☠️
This file contains 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
def broken_function(): | |
not_a_dictionary = 1 | |
not_a_dictionary.append("hello") | |
broken_function() |
This file contains 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 flask import Flask | |
# create your app | |
app = Flask(__name__) | |
# create application routes | |
@app.route("/hello") | |
def say_hello(): | |
return "Hello!" | |
This file contains 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 flask import Flask | |
# importing codelighthouse's SDK | |
from codelighthouse import CodeLighthouse | |
# configure the SDK | |
lighthouse = CodeLighthouse( | |
organization_name="Your organization name here", | |
x_api_key="your API key here", | |
resource_name="Sample Flask App", # the resource name is up to you |
This file contains 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 flask import Flask | |
# importing codelighthouse's SDK | |
from codelighthouse import CodeLighthouse | |
# configure the SDK | |
lighthouse = CodeLighthouse( | |
organization_name="Your organization name here", | |
x_api_key="your API key here", | |
resource_name="Sample Flask App", # the resource name is up to you |
This file contains 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
// IMPORT CODELIGHTHOUSE | |
const CodeLighthouse = require('codelighthouse'); | |
// INSTANTIATE THE ERROR CATCHER | |
const codelighthouse = new CodeLighthouse( | |
organization_name="your organization name", | |
api_key="your API Key", | |
default_email="code owner's email address" | |
resource_group="serverless-applications", | |
resource_name="notifications-app" |
This file contains 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
// NOTE: make sure you've imported and configured codelighthouse first! | |
const app = express(); | |
// NOTE: this must be the first piece of middleware in the app | |
app.use(codelighthouse.integrations.express.requestHandler); | |
// your routes and middleware go here | |
app.route("/", (request, response, next) => { | |
// CODE HERE | |
}); |
This file contains 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
// NOTE: make sure you've imported and configured codelighthouse first! | |
try { | |
// your code here | |
} | |
catch (err) { | |
// send the error notification to the user specified in the SDK configuration | |
codelighthouse.error(err); | |
// alternatively, you can send it to a user of your choice: | |
codelighthouse.error(err, "user@your_comapny.com"); |
This file contains 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
import s3_bucket as S3 | |
import os | |
# get your key data from environment variables | |
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID') | |
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY') | |
# initialize the package | |
S3.Bucket.prepare(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) |
This file contains 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
bucket = S3.Bucket('your bucket name') | |
#example | |
bucket = S3.Bucket('my-website-data') |
This file contains 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
try: | |
bucket = S3.Bucket('my-bucket-name') | |
data, metadata = bucket.get('some key') | |
except S3.Exceptions.NoSuchBucket as e: | |
# some error handling here | |
pass |
OlderNewer