Skip to content

Commit 284875c

Browse files
committed
Update README.md
Remove extra code to show simple installation.
1 parent 53551c4 commit 284875c

File tree

1 file changed

+8
-41
lines changed

1 file changed

+8
-41
lines changed

README.md

+8-41
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,13 @@ pip install moesif_aws_lambda
2121

2222
## How to use
2323

24-
The following shows how import the module and use:
25-
26-
### 1. Import the module:
24+
### 1. Add middleware to your Lambda application.
2725

2826
```python
2927
from moesif_aws_lambda.middleware import MoesifLogger
30-
import os
31-
32-
# Moesif Application Id
33-
os.environ["MOESIF_APPLICATION_ID"] = "Your Moesif Application Id"
34-
35-
def identify_user(event, context):
36-
return 'my_user_id'
37-
38-
def identify_company(event, context):
39-
return 'my_company_id'
40-
41-
def get_api_version(event, context):
42-
return '1.0.0'
43-
44-
def get_session_token(event, context):
45-
return '23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f'
46-
47-
def get_metadata(event, context):
48-
return { 'foo' : 'aws lambda', 'bar' : 'aws lambda metadata', }
49-
50-
def mask_event(eventmodel):
51-
return eventmodel
52-
53-
def should_skip(event, context):
54-
return "/" in event['path']
5528

5629
moesif_options = {
57-
'GET_METADATA': get_metadata,
58-
'IDENTIFY_USER': identify_user,
59-
'IDENTIFY_COMPANY': identify_company,
60-
'GET_SESSION_TOKEN': get_session_token,
61-
'GET_API_VERSION': get_api_version,
62-
'MASK_EVENT_MODEL': mask_event,
63-
'SKIP': should_skip,
64-
'LOG_BODY': True,
65-
'DEBUG': True
30+
'LOG_BODY': True
6631
}
6732

6833
@MoesifLogger(moesif_options)
@@ -79,8 +44,10 @@ def lambda_handler(event, context):
7944
}
8045
```
8146

82-
### 2. Enter Moesif Application Id
83-
Your Moesif Application Id can be found in the [_Moesif Portal_](https://www.moesif.com/).
47+
### 2. Set MOESIF_APPLICATION_ID environment variable
48+
49+
Add a new environment variable with the name `MOESIF_APPLICATION_ID` and the value being your Moesif application id,
50+
which can be found in the [_Moesif Portal_](https://www.moesif.com/).
8451
After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps.
8552

8653
You can always find your Moesif Application Id at any time by logging
@@ -124,7 +91,7 @@ individual customers and the companies their a part of.
12491
```python
12592
def identify_company(event, context):
12693
# your code here, must return a string
127-
return 'my_company_id'
94+
return '7890'
12895
}
12996
```
13097

@@ -139,7 +106,7 @@ session token (i.e. such as an API key).
139106
```python
140107
def get_session_token(event, context):
141108
# your code here, must return a string.
142-
return '23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f'
109+
return 'XXXXXXXXX'
143110
```
144111

145112
#### __`GET_API_VERSION`__

0 commit comments

Comments
 (0)