Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developersindia/metrics

📈 developersIndia community metrics/stats API
https://github.com/developersindia/metrics

api developersindia praw-reddit python3 static-api subreddit-analytics subreddit-metrics subreddit-stats

Last synced: about 1 month ago
JSON representation

📈 developersIndia community metrics/stats API

Awesome Lists containing this project

README

        

# metrics 📈

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg)](#contributors-)
[![Discord](https://img.shields.io/discord/669880381649977354?color=%237289da&label=Discord&logo=Discord)](https://discordapp.com/invite/MKXMSNC)
[![Subreddit subscribers](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdevelopersindia.github.io%2Fmetrics%2Fdata%2F&query=%24.totalMembers&suffix=%20members&style=flat&logo=reddit&label=r%2FdevelopersIndia&color=orange&link=https%3A%2F%2Fwww.reddit.com%2Fr%2FdevelopersIndia
)](https://www.reddit.com/r/developersIndia/)

> Generate developersIndia Community Stats from Subreddit

Currently the stats are generated in following JSON format:

```json
{
"totalMembers": 66600,
"lastMonthUniquePageViews": 79519,
"lastMonthTotalPageViews": 1286500,
"yesterdayUniquePageViews": 18929,
"yesterdayTotalPageViews": 71916,
"discordTotalMembers": 7269,
"discordTotalActiveMembers": 633
}
```

## Setup 👷

1. Clone the repo

```bash
git clone https://github.com/developersIndia/metrics.git
```
2. Initialise a virtual environment.

```bash
cd metrics
python3 -m venv venv
source venv/bin/activate
```
3. Install dependencies

```bash
pip install -r requirements.txt
```
4. Export environment variables.
* Reddit(Make sure you are have moderator privileges for the subreddit you want stats for).
```
export REDDIT_CLIENT_ID=
export REDDIT_CLIENT_SECRET=
export REDDIT_PASSWORD=
export REDDIT_USER=
```
* Discord(If possible set expiry to never)
```
export DISCORD_INVITE_CODE=
```
## Testing

Run the following command to run the test suite:
```bash
python -m unittest
```

## Resources & Learning Material 📚

- [PRAW Docs](https://praw.readthedocs.io/en/latest/code_overview/models/subreddit.html#praw.models.Subreddit.traffic)

# 📜 License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):



MaDDogx
MaDDogx

💻 ⚠️
Anil Khatri
Anil Khatri

💻

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!