Browse Source

Группа одноклассников указывается в настройках #40

pull/45/head
Artur Galyamov 2 years ago
parent
commit
85c97f3dd4
  1. 3
      .env.example
  2. 3
      cms/promoters.py
  3. 2
      crossposting_backend/settings.py

3
.env.example

@ -6,4 +6,5 @@ VK_PASSWORD=123123
VK_OWNER_ID=-2 VK_OWNER_ID=-2
OK_ACCESS_TOKEN=aatk OK_ACCESS_TOKEN=aatk
OK_APPLICATION_KEY=FFCF OK_APPLICATION_KEY=FFCF
OK_APPLICATION_SECRET_KEY=GGD OK_APPLICATION_SECRET_KEY=GGD
OK_GROUP_ID=700

3
cms/promoters.py

@ -63,6 +63,7 @@ class OdnoklassnikiPromoter(Promoter):
ok_access_token = promoter_secrets['OK_ACCESS_TOKEN'] ok_access_token = promoter_secrets['OK_ACCESS_TOKEN']
ok_application_key = promoter_secrets['OK_APPLICATION_KEY'] ok_application_key = promoter_secrets['OK_APPLICATION_KEY']
ok_application_secret_key = promoter_secrets['OK_APPLICATION_SECRET_KEY'] ok_application_secret_key = promoter_secrets['OK_APPLICATION_SECRET_KEY']
ok_group_id = promoter_secrets['OK_GROUP_ID']
session = ok_api.OkApi(access_token=ok_access_token, session = ok_api.OkApi(access_token=ok_access_token,
application_key=ok_application_key, application_key=ok_application_key,
@ -82,7 +83,7 @@ class OdnoklassnikiPromoter(Promoter):
encoded_attachments = JSONEncoder().encode(attachments) encoded_attachments = JSONEncoder().encode(attachments)
try: try:
session.mediatopic.post(type='GROUP_THEME', session.mediatopic.post(type='GROUP_THEME',
gid='70000001426867', gid=ok_group_id,
attachment=encoded_attachments) attachment=encoded_attachments)
except ok_api.OkApiException as exc: except ok_api.OkApiException as exc:
raise PromoteError(exc) raise PromoteError(exc)

2
crossposting_backend/settings.py

@ -42,7 +42,7 @@ dotenv.read_dotenv(env_file)
promoter_env_keys = ( promoter_env_keys = (
'TELEGRAM_BOT_TOKEN', 'TELEGRAM_CHAT_ID', 'JOOMLA_TOKEN', 'TELEGRAM_BOT_TOKEN', 'TELEGRAM_CHAT_ID', 'JOOMLA_TOKEN',
'VK_LOGIN', 'VK_PASSWORD', 'VK_OWNER_ID', 'OK_ACCESS_TOKEN', 'OK_APPLICATION_KEY', 'VK_LOGIN', 'VK_PASSWORD', 'VK_OWNER_ID', 'OK_ACCESS_TOKEN', 'OK_APPLICATION_KEY',
'OK_APPLICATION_SECRET_KEY', 'OK_APPLICATION_SECRET_KEY', 'OK_GROUP_ID',
) )
promoter_secrets = {} promoter_secrets = {}
if ENV_ENCODED: if ENV_ENCODED:

Loading…
Cancel
Save