clarity-api


Nameclarity-api JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/Knuckles-Team/clarity-api
SummaryMicrosoft Clarity Data Export API
upload_time2024-07-26 15:32:20
maintainerNone
docs_urlNone
authorAudel Rouhi
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements requests urllib3 pydantic
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Microsoft Clarity API

![PyPI - Version](https://img.shields.io/pypi/v/clarity-api)
![PyPI - Downloads](https://img.shields.io/pypi/dd/clarity-api)
![GitHub Repo stars](https://img.shields.io/github/stars/Knuckles-Team/clarity-api)
![GitHub forks](https://img.shields.io/github/forks/Knuckles-Team/clarity-api)
![GitHub contributors](https://img.shields.io/github/contributors/Knuckles-Team/clarity-api)
![PyPI - License](https://img.shields.io/pypi/l/clarity-api)
![GitHub](https://img.shields.io/github/license/Knuckles-Team/clarity-api)

![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/Knuckles-Team/clarity-api)
![GitHub pull requests](https://img.shields.io/github/issues-pr/Knuckles-Team/clarity-api)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/Knuckles-Team/clarity-api)
![GitHub issues](https://img.shields.io/github/issues/Knuckles-Team/clarity-api)

![GitHub top language](https://img.shields.io/github/languages/top/Knuckles-Team/clarity-api)
![GitHub language count](https://img.shields.io/github/languages/count/Knuckles-Team/clarity-api)
![GitHub repo size](https://img.shields.io/github/repo-size/Knuckles-Team/clarity-api)
![GitHub repo file count (file type)](https://img.shields.io/github/directory-file-count/Knuckles-Team/clarity-api)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/clarity-api)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/clarity-api)

*Version: 0.0.3*

**Microsoft Clarity Data Export API**

This Python library allows you to work with the dashboard data. The data can be structured over a specified date range 
and can break down insights by up to three dimensions.

Find out more about the [Clarity Data Export API](https://learn.microsoft.com/en-us/clarity/setup-and-installation/clarity-data-export-api)

This repository is actively maintained - Contributions are welcome!

<details>
  <summary><b>Getting Started:</b></summary>

### Prerequisites
- An active Microsoft Clarity account. [Learn how to sign up for Clarity](https://clarity.microsoft.com).
- An API access token generated by the project's admin from the settings page.
- Python3.8+

### Obtaining Access Tokens
**Note**: Only project admins can manage access tokens.

1. Go to your Clarity project. Select `Settings` -> `Data Export` -> `Generate new API token`.
2. Provide a descriptive name for the token for easy identification.

## Parameters
- `numOfDays`: (1, 2, or 3) The number of days for the data export since the API call, relating to the last 24, 48, or 72 hours, respectively.
- `dimension1`: The first dimension to break down insights.
- `dimension2`: The second dimension to break down insights.
- `dimension3`: The third dimension to break down insights.

#### Dimension Options:
- Browser
- Device
- Country
- OS
- Source
- Medium
- Campaign
- Channel
- URL

</details>

<details>
  <summary><b>Usage:</b></summary>

```python
#!/usr/bin/python
# coding: utf-8
import clarity_api

# Use token generated from the steps above
token = "<TOKEN>"
url = "https://www.clarity.ms"
client = clarity_api.Api(url=url, token=token)

data = client.get_data_export(number_of_days=2, dimension_1="OS", dimension_2="Channel")
print("Pydantic Object:", data)
print("Raw Request Output:", data.raw_output)
print("JSON Request Output:", data.json_output)
print("Pydantic Object Model Dump:", data.model_dump())
print("Request Status Code:", data.status_code)
print("Request Error:", data.error)
```

</details>

<details>
  <summary><b>Installation Instructions:</b></summary>

Install Python Package

```bash
python -m pip install clarity-api
```

</details>

<details>
  <summary><b>Tests:</b></summary>

pre-commit check
```bash
pre-commit run --all-files
```

pytest
```bash
pytest ./test/test_clarity_models.py
```
</details>


<details>
  <summary><b>Repository Owners:</b></summary>


<img width="100%" height="180em" src="https://github-readme-stats.vercel.app/api?username=Knucklessg1&show_icons=true&hide_border=true&&count_private=true&include_all_commits=true" />

![GitHub followers](https://img.shields.io/github/followers/Knucklessg1)
![GitHub User's stars](https://img.shields.io/github/stars/Knucklessg1)
</details>



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Knuckles-Team/clarity-api",
    "name": "clarity-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Audel Rouhi",
    "author_email": "knucklessg1@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "# Microsoft Clarity API\n\n![PyPI - Version](https://img.shields.io/pypi/v/clarity-api)\n![PyPI - Downloads](https://img.shields.io/pypi/dd/clarity-api)\n![GitHub Repo stars](https://img.shields.io/github/stars/Knuckles-Team/clarity-api)\n![GitHub forks](https://img.shields.io/github/forks/Knuckles-Team/clarity-api)\n![GitHub contributors](https://img.shields.io/github/contributors/Knuckles-Team/clarity-api)\n![PyPI - License](https://img.shields.io/pypi/l/clarity-api)\n![GitHub](https://img.shields.io/github/license/Knuckles-Team/clarity-api)\n\n![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/Knuckles-Team/clarity-api)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/Knuckles-Team/clarity-api)\n![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/Knuckles-Team/clarity-api)\n![GitHub issues](https://img.shields.io/github/issues/Knuckles-Team/clarity-api)\n\n![GitHub top language](https://img.shields.io/github/languages/top/Knuckles-Team/clarity-api)\n![GitHub language count](https://img.shields.io/github/languages/count/Knuckles-Team/clarity-api)\n![GitHub repo size](https://img.shields.io/github/repo-size/Knuckles-Team/clarity-api)\n![GitHub repo file count (file type)](https://img.shields.io/github/directory-file-count/Knuckles-Team/clarity-api)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/clarity-api)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/clarity-api)\n\n*Version: 0.0.3*\n\n**Microsoft Clarity Data Export API**\n\nThis Python library allows you to work with the dashboard data. The data can be structured over a specified date range \nand can break down insights by up to three dimensions.\n\nFind out more about the [Clarity Data Export API](https://learn.microsoft.com/en-us/clarity/setup-and-installation/clarity-data-export-api)\n\nThis repository is actively maintained - Contributions are welcome!\n\n<details>\n  <summary><b>Getting Started:</b></summary>\n\n### Prerequisites\n- An active Microsoft Clarity account. [Learn how to sign up for Clarity](https://clarity.microsoft.com).\n- An API access token generated by the project's admin from the settings page.\n- Python3.8+\n\n### Obtaining Access Tokens\n**Note**: Only project admins can manage access tokens.\n\n1. Go to your Clarity project. Select `Settings` -> `Data Export` -> `Generate new API token`.\n2. Provide a descriptive name for the token for easy identification.\n\n## Parameters\n- `numOfDays`: (1, 2, or 3) The number of days for the data export since the API call, relating to the last 24, 48, or 72 hours, respectively.\n- `dimension1`: The first dimension to break down insights.\n- `dimension2`: The second dimension to break down insights.\n- `dimension3`: The third dimension to break down insights.\n\n#### Dimension Options:\n- Browser\n- Device\n- Country\n- OS\n- Source\n- Medium\n- Campaign\n- Channel\n- URL\n\n</details>\n\n<details>\n  <summary><b>Usage:</b></summary>\n\n```python\n#!/usr/bin/python\n# coding: utf-8\nimport clarity_api\n\n# Use token generated from the steps above\ntoken = \"<TOKEN>\"\nurl = \"https://www.clarity.ms\"\nclient = clarity_api.Api(url=url, token=token)\n\ndata = client.get_data_export(number_of_days=2, dimension_1=\"OS\", dimension_2=\"Channel\")\nprint(\"Pydantic Object:\", data)\nprint(\"Raw Request Output:\", data.raw_output)\nprint(\"JSON Request Output:\", data.json_output)\nprint(\"Pydantic Object Model Dump:\", data.model_dump())\nprint(\"Request Status Code:\", data.status_code)\nprint(\"Request Error:\", data.error)\n```\n\n</details>\n\n<details>\n  <summary><b>Installation Instructions:</b></summary>\n\nInstall Python Package\n\n```bash\npython -m pip install clarity-api\n```\n\n</details>\n\n<details>\n  <summary><b>Tests:</b></summary>\n\npre-commit check\n```bash\npre-commit run --all-files\n```\n\npytest\n```bash\npytest ./test/test_clarity_models.py\n```\n</details>\n\n\n<details>\n  <summary><b>Repository Owners:</b></summary>\n\n\n<img width=\"100%\" height=\"180em\" src=\"https://github-readme-stats.vercel.app/api?username=Knucklessg1&show_icons=true&hide_border=true&&count_private=true&include_all_commits=true\" />\n\n![GitHub followers](https://img.shields.io/github/followers/Knucklessg1)\n![GitHub User's stars](https://img.shields.io/github/stars/Knucklessg1)\n</details>\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Microsoft Clarity Data Export API",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/Knuckles-Team/clarity-api"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10c0fa14a53ae6e2df41fcf9d9c43de5da1fa6a046ae1721bcfa8799ccaa67ee",
                "md5": "5d7c564338d84a64ca6a83af47316fe1",
                "sha256": "47f74780e62e6684654e51a5d70f6617d3e6dcbd33872e5187996a6c9a01224b"
            },
            "downloads": -1,
            "filename": "clarity_api-0.0.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5d7c564338d84a64ca6a83af47316fe1",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 8436,
            "upload_time": "2024-07-26T15:32:20",
            "upload_time_iso_8601": "2024-07-26T15:32:20.499478Z",
            "url": "https://files.pythonhosted.org/packages/10/c0/fa14a53ae6e2df41fcf9d9c43de5da1fa6a046ae1721bcfa8799ccaa67ee/clarity_api-0.0.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-26 15:32:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Knuckles-Team",
    "github_project": "clarity-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.8.1"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    ">=",
                    "2.2.2"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2.8.2"
                ]
            ]
        }
    ],
    "lcname": "clarity-api"
}
        
Elapsed time: 0.30198s