INNER CODE UNIT · Python

__init__

defiprime/defiprime1 · scripts/algolia-index.py:133

    def __init__(self, app_id, admin_key, http):
        self.app_id = app_id
        self.http = http
        self.headers = {
            "X-Algolia-Application-Id": app_id,
            "X-Algolia-API-Key": admin_key,
            "Content-Type": "application/json",
        }

    def url(self, path):
        return f"https://{self.app_id}.algolia.net{path}"

    def post(self, path, payload):
        return self.http("POST", self.url(path), self.headers, payload)

    def get(self, path):
        return self.http("GET", self.url(path), self.headers, None)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…