Skip to main content

SuperMetrics Assignment package

Project description

Supported Versions

SmStats: Get Searchmetric User Posts Statistics (Assignment)

SmStats is a simple library to get statistics about user posts.

Installing SmStats and Supported Versions

SmStats is available on PyPI:

$ python -m pip install smstats

Smstats officially supports Python 3+.

Usage

SmStats get posts of users from Supermetrics and return statistics.

from smstats import PostManager, Config, DataGetError

# Optional configuration
config = Config()
config.client_id = 'demo_cl'
config.name = 'abc'
config.email = 'abc@gmail.com'
config.max_page = 4

try:
    manager = PostManager(config)
    stats = manager.get_posts_stats()
    print(stats)
except DataGetError as ex:
    print(ex)
{
  'avg_postlen_per_month': {
     '10-2021': 378.51,
     '9-2021': 391.81,
   },
   'longest_post_per_month': {
     '10-2021': 734,
     '9-2021': 732
   }, 
   'total_posts_by_week': {
     '42': 1,
     '41': 39,
     '40': 38,
     '39': 38
   },
   'avg_post_per_user_per_month': {
     '10-2021': 4.7,
     '9-2021': 8.05
   }
}

Defaults

Parameter Value
client_id ju16a6m81mhid5ue1z3v2g0uh
email manish@gmail.com
name manish

Development

This package can be easily extended in few simple steps

  1. New post descriptor can be added to PostDetails dataclass in custom.py
  2. Code to get this new post descriptor can be added to get_post_details function in postdetails.py
  3. Cumulative summary creation can be controlled through build_posts_summary function in postdetails.py
  4. New statistics could be extracted from the summary by extending get_stats function in postdetails.py

Running unit tests

python test.py

Other considerations

This project seeks to keep a perfect pylint score. It is advised to run pylint before every commit. If an exception is needed, specific pylint warnings must be explicitly disabled.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smstats-1.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smstats-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file smstats-1.0.0.tar.gz.

File metadata

  • Download URL: smstats-1.0.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for smstats-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0dce9f5b2ba40e4a9b20e4eec0119b7ef91acbadfa09d12b9c7a3d8c8dd3a9cb
MD5 025725f0108694be43952645568f9f8c
BLAKE2b-256 429eda0809d2a4e044b2e1c7cb181fb234290094711351c5dabc985e0fa96fe0

See more details on using hashes here.

File details

Details for the file smstats-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: smstats-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for smstats-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5a6999d7f38cc81cd47dfc0a450a9f4048069117f2a591be67bbd829cbda7aa
MD5 d36332d3865db9705262a04dfede6c67
BLAKE2b-256 3aad74bcf6cd5831d16397ef7ff3cb7c3c56932d0f23c6148bd639a3318a8271

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page