Skip to content

Commit

Permalink
Last commit for Labs :(
Browse files Browse the repository at this point in the history
  • Loading branch information
judtinzhang committed Apr 28, 2024
1 parent e89bf02 commit addb1c7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

## Requirements

* Python 3.6+
* Django 2.1+
* Python 3.11+
* Django 5.0+

## Installation

Expand All @@ -20,6 +20,7 @@ INSTALLED_APPS = (
...
'accounts.apps.AccountsConfig',
'identity.apps.IdentityConfig', # If you want to enable B2B IPC
'analytics.apps.AnalyticsConfig',
...
)
```
Expand Down Expand Up @@ -118,6 +119,21 @@ class CustomBackend(LabsUserBackend):
user.save()
```

## Analytics

DLA provides a wrapper class to submit analytics data from Labs backend servers to the Labs Analytics Server. For local testing, the necessary environment variables are the `CLIENT_ID`, `CLIENT_SECRET`, and `PLATFORM_URL`. Upon loading these variables, you can send data as follows:
```python
def generate_data(self):
return {
"product": Product.MOBILE_BACKEND,
"pennkey": None,
"data": [{"key": f"{self.rand_int()}", "value": f"{self.rand_int()}"}],
}

txn = AnalyticsTxn(**self.generate_data())
self.analytics_wrapper.submit(txn)
```

## B2B IPC

DLA also provides an interface for backend to backend IPC requests. With B2B IPC implemented, the backend of a product will—at startup time—request platform for a JWT to verify its identity. Each product will have an allow-list, and this will enable products to make requests to each other.
Expand Down

0 comments on commit addb1c7

Please sign in to comment.