Skip to main content

Django implementation for vkontakte API Wall Statistic

Project description

Django Vkontakte Wall Statistic
===============================

[![PyPI version](https://badge.fury.io/py/django-vkontakte-wall-statistic.png)](http://badge.fury.io/py/django-vkontakte-wall-statistic) [![Build Status](https://travis-ci.org/ramusus/django-vkontakte-wall-statistic.png?branch=master)](https://travis-ci.org/ramusus/django-vkontakte-wall-statistic) [![Coverage Status](https://coveralls.io/repos/ramusus/django-vkontakte-wall-statistic/badge.png?branch=master)](https://coveralls.io/r/ramusus/django-vkontakte-wall-statistic)

Приложение позволяет взаимодействовать со статистикой сообщений Вконтакте через Вконтакте API и парсер используя стандартные модели Django

Установка
---------

pip install django-vkontakte-wall-statistic

В `settings.py` необходимо добавить:

INSTALLED_APPS = (
...
'oauth_tokens',
'taggit',
'vkontakte_api',
'vkontakte_users',
'vkontakte_groups',
'vkontakte_wall',
'vkontakte_wall_statistic',
)

# oauth-tokens settings
OAUTH_TOKENS_HISTORY = True # to keep in DB expired access tokens
OAUTH_TOKENS_VKONTAKTE_CLIENT_ID = '' # application ID
OAUTH_TOKENS_VKONTAKTE_CLIENT_SECRET = '' # application secret key
OAUTH_TOKENS_VKONTAKTE_SCOPE = ['ads,wall,photos,friends,stats'] # application scopes
OAUTH_TOKENS_VKONTAKTE_USERNAME = '' # user login
OAUTH_TOKENS_VKONTAKTE_PASSWORD = '' # user password
OAUTH_TOKENS_VKONTAKTE_PHONE_END = '' # last 4 digits of user mobile phone

Покрытие методов API
--------------------

* [stats.get](http://vk.com/dev/stats.getPostStats) – возвращает статистику рекламной записи сообщества;

Примеры использования
---------------------

### Получение статистики группы

Получение статистики группы через API

>>> from vkontakte_groups.models import Group
>>> group = Group.remote.fetch(ids=[16297716])[0]
>>> group.fetch_statistic(source='api')

Статистика, полученная через API доступна через менеджер

>>> stat = group.statistics_api.all()[0]
>>> stat.__dict__
{'_state': <django.db.models.base.ModelState at 0xa2812ac>,
'age_18': 240,
'age_18_21': 86,
'age_21_24': 75,
'age_24_27': 59,
'age_27_30': 31,
'age_30_35': 23,
'age_35_45': 9,
'age_45': 13,
'date': datetime.date(2012, 3, 14),
'females': 295,
'fetched': datetime.datetime(2012, 9, 12, 0, 50, 42, 597930),
'group_id': 14,
'id': 182,
'males': 406,
'views': 1401,
'visitors': 702}

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

django-vkontakte-wall-statistic-0.6.0.tar.gz (22.1 kB view details)

Uploaded Source

File details

Details for the file django-vkontakte-wall-statistic-0.6.0.tar.gz.

File metadata

File hashes

Hashes for django-vkontakte-wall-statistic-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8ca9b07831906aae1a41ea8bc1e677f4ed65f6f6717537d538817ead9d9df116
MD5 55970fcf863a31e101cc026eb6476f02
BLAKE2b-256 67456b7cc2e22de3014d60738e13810c19e1c95705308ec8a26d4dce2ea2266c

See more details on using hashes here.

Supported by

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