Skip to main content
yametrikapy
===========

The library support only JSON format.

To sign in you need client_id, get it from https://tech.yandex.ru/oauth/doc/dg/tasks/register-client-docpage/ for your application.

To connect to Yandex.Metric, you need to get a code:

- `The token by code received automatically <https://tech.yandex.ru/oauth/doc/dg/reference/auto-code-client-docpage/>`_
- `The token by code entered by a user <https://tech.yandex.ru/oauth/doc/dg/reference/console-client-docpage/>`_

.. code-block:: python

client_id = '6993a3cd88e34ac67574578th87h67r7fe341c'
client_secret = 'AQAg4h45h4DJk4545gBDqIln6hNJGet45DHJgVxCjncQ'
code = '3463468'

metrika = Metrika(client_id, client_secret=client_secret, code=code)

or `to obtain a debug token manually <https://tech.yandex.ru/oauth/doc/dg/tasks/get-oauth-token-docpage/>`_.

.. code-block:: python

client_id = '6993a3cd88e34ac67574578th87h67r7fe341c'
token = 'AQAg4h45h4DJk4545gBDqIln6hNJGet45DHJgVxCjncQ'

metrika = Metrika(client_id, token=token)

Installation
------------
::

pip install yametrikapy

Example usage
-------------

.. code-block:: python

from yametrikapy import Metrika

def main():
client_id = '6993a3cd88e34ac67574578th87h67r7fe341c'
client_secret = 'AQAg4h45h4DJk4545gBDqIln6hNJGet45DHJgVxCjncQ'
code = '3463468'

metrika = Metrika(client_id, client_secret=client_secret, code=code)

counters = metrika.counters().counters
print(counters)

counter_id = counters[0]['id']
stat = metrika.stat_data(counter_id, 'ym:s:visits,ym:s:users', dimensions='ym:s:searchEngineName')
print(stat.data)

counter = metrika.add_counter('My new counter', 'my-site.ru')
print(counter.counter['id'], counter.counter['name'])

# Output obtained data
print metrika.get_data()

if __name__ == '__main__':
main()

Metadata

Release files for yametrikapy 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yametrikapy 2.0
File Size Uploaded Provenance Actions
yametrikapy-2.0.tar.gz 12.3 kB Without provenance Details for yametrikapy-2.0.tar.gz

Release files / yametrikapy-2.0.tar.gz

Download URL yametrikapy-2.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8c55d89f0fb9c1a13bba162279987de4d1afee9551c7207160351c4d3f86bc91
BLAKE2b-256 checksum
How to use checksums
4aa8e35551b4a51761ed15c2c656fcfcd6be43359f213c3824237fae268bf33e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for yametrikapy 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page