AppMetrica
Application for integrating with Yandex AppMetrica https://appmetrica.yandex.ru/
Yandex Docs https://tech.yandex.ru/appmetrica/doc/mobile-api/push/use-cases-docpage/
Before using API it is necessary:
Get application id from your account in appmetrica.yandex.ru
[Generate access token](https://tech.yandex.ru/appmetrica/doc/mobile-api/intro/authorization-docpage/)
Send push
Create API instance:
from appmetrica.push.api import PushAPI api = PushAPI(application_id, access_token)
Create group to combine the sending in the report:
group_id = api.create_group('test-push-1', send_rate=500)Pass group_id, device list and message to send_push method and call:
from appmetrica.push.api import TokenTypes transfer_id = api.send_push(group_id, devices=devices, ios_message=ios_message, android_message=android_message, tag='harry potter') devices - list of token objects like: [ { "id_type": TokenTypes.APPMETRICA_DEVICE_ID, "id_values": ["123456789", "42"] }, { "id_type": TokenTypes.IOS_IFA, "id_values": ["8A690667-6204-4A6A-9B38-85DE016....."] }, { "id_type": TokenTypes.ANDROID_PUSH_TOKEN, "id_values": ["eFfxdO7uCMw:APA91bF1tN3X3BAbiJXsQhk-..."] } ] ios_message - push message for ios devices android_message - push message for android devices: { "silent": false, "content": { "title": "string", "text": "string", "sound": "disable", "data": "string" } }To check status of push call check_status method:
status = api.check_status(transfer_id)
List of available groups
Create API instance:
from appmetrica.push.api import PushAPI api = PushAPI(application_id, access_token)
Get list of groups
group_id = api.get_groups()
Export tokens
Create API instance:
from appmetrica.export.api import ExportAPI api = ExportAPI(application_id, access_token)
Call push_tokens method with necessary fields:
data = api.export_push_tokens('token', 'ios_ifa', 'google_aid')
Export devices
Create API instance:
from appmetrica.export.api import ExportAPI api = ExportAPI(application_id, access_token)
Call push_tokens method with necessary fields:
date_till = datetime.now() date_from = date_till - timedelta(days=7) data = api.export_installations('ios_ifv', date_from=date_from, date_till=date_till)
Publish a release on PyPi
Install twine globally:
pip install twine
Don’t forget to bump the package version:
__version__ = '1.0.5'
Build the release:
python setup.py sdist bdist_wheel
Publish the release on PyPi:
twine upload dist/*
Changelog
1.0.6 (2020-11-11)
Add send rate when create appmetrica group
1.0.5 (2020-10-01)
Add retry for appmetrica request and declare python 3.8 support
1.0.4 (2020-06-26)
Allow to send raw data
1.0.3 (2019-08-04)
Declare python 3.7 support
1.0.2 (2019-01-09)
Increased request timeout to 30 seconds
1.0.1 (2018-12-17)
Replace deprecated send method to send-batch
1.0.0 (2017-12-14)
Initial release
Metadata
Release files for appmetrica 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| appmetrica-1.0.7-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Release files / appmetrica-1.0.7-py2.py3-none-any.whl
| Download URL | appmetrica-1.0.7-py2.py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1383364ca6027511aead4091616afa6e1bdfab58417b02053739e156660414dc
|
|
BLAKE2b-256 checksum How to use checksums |
41e8bf489f1ad6cb3f47919c5f4ab30bd0c4d19a84d5ff731d387c789502eff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4
|