Module lunar.rec.recommendations

Sub-modules

lunar.rec.recommendations.models
lunar.rec.recommendations.recommendation

Classes

class RecommendationClient (config: Config)

Client for BAP Recommendation API (/v1/recommend/).

Example

import bap

client = bap.client("recommend")

Ancestors

Methods

def recommend(self, id: str, channel_id: str, params: Dict[str, Any] = {}, headers: Dict[str, Any] = {}) ‑> Dict[str, Any]

Get recommended items for the target.

Args

  • id: (str) Unique identifier of a recommendation target
  • channel_id: (str) Unique identifier of a channel
  • params: (optional) (dict) Additional parameters for recommendation
  • headers: (optional) (dict) Headers being sent to API server

Returns

dict

Example

result = client.recommend(id="a", channel_id="my_channel", params={"first_param": 100, "second_param": "value"}
async def recommend_async(self, id: str, channel_id: str, params: Dict[str, Any] = {}, headers: Dict[str, Any] = {}) ‑> Dict[str, Any]

Get recommended items for the target (async).

Args

  • id: (str) Unique identifier of a recommendation target
  • channel_id: (str) Unique identifier of a channel
  • params: (optional) (dict) Additional parameters for recommendation
  • headers: (optional) (dict) Headers being sent to API server

Returns

dict

Example

result = await client.recommend_async(id="a", channel_id="my_channel", params={"first_param": 100, "second_param": "value"}