How to use notifyclient method in pyatom

Best Python code snippet using pyatom_python

wot_plus_controller.py

Source:wot_plus_controller.py Github

copy

Full Screen

1import BigWorld2from bootcamp.Bootcamp import g_bootcamp3from constants import RENEWABLE_SUBSCRIPTION_CONFIG4from gui.server_events import settings5from helpers import dependency6from messenger.m_constants import SCH_CLIENT_MSG_TYPE7from skeletons.gui.game_control import IWotPlusNotificationController8from skeletons.gui.lobby_context import ILobbyContext9from skeletons.gui.system_messages import ISystemMessages10class _INotificationStrategy(object):11 _systemMessages = dependency.descriptor(ISystemMessages)12 def notifyClient(self, lastSeenStatus, currentStatus, enableMsgId, disableMsgId):13 raise NotImplementedError14class _LoginNotificationStrategy(_INotificationStrategy):15 def notifyClient(self, lastSeenStatus, currentStatus, enableMsgId, disableMsgId):16 if not currentStatus:17 self._systemMessages.proto.serviceChannel.pushClientMessage({}, disableMsgId)18 elif lastSeenStatus != currentStatus:19 if not currentStatus:20 self._systemMessages.proto.serviceChannel.pushClientMessage({}, disableMsgId)21 else:22 self._systemMessages.proto.serviceChannel.pushClientMessage({}, enableMsgId)23class _SessionNotificationStrategy(_INotificationStrategy):24 def notifyClient(self, lastSeenStatus, currentStatus, enableMsgId, disableMsgId):25 if lastSeenStatus != currentStatus:26 if not currentStatus:27 self._systemMessages.proto.serviceChannel.pushClientMessage({}, disableMsgId)28 else:29 self._systemMessages.proto.serviceChannel.pushClientMessage({}, enableMsgId)30class WotPlusNotificationController(IWotPlusNotificationController):31 _lobbyContext = dependency.descriptor(ILobbyContext)32 def __init__(self):33 super(WotPlusNotificationController, self).__init__()34 self._validSessionStarted = False35 def onLobbyStarted(self, ctx):36 self._lobbyContext.getServerSettings().onServerSettingsChange += self._onServerSettingsChange37 self.processSwitchNotifications()38 self._validSessionStarted = False if g_bootcamp.isRunning() else True39 def onAccountBecomeNonPlayer(self):40 self._lobbyContext.getServerSettings().onServerSettingsChange -= self._onServerSettingsChange41 def onDisconnected(self):42 self._validSessionStarted = False43 self._lobbyContext.getServerSettings().onServerSettingsChange -= self._onServerSettingsChange44 def _getStrategy(self):45 if self._validSessionStarted:46 return _SessionNotificationStrategy()47 return _LoginNotificationStrategy()48 def processSwitchNotifications(self):49 if g_bootcamp.isRunning():50 return51 serverSettings = self._lobbyContext.getServerSettings()52 isWotPlusEnabled = serverSettings.isRenewableSubEnabled()53 isEntryPointsEnabled = serverSettings.isWotPlusNewSubscriptionEnabled()54 isGoldReserveEnabled = serverSettings.isRenewableSubGoldReserveEnabled()55 isPassiveXpEnabled = serverSettings.isRenewableSubPassiveCrewXPEnabled()56 isTankRentalEnabled = serverSettings.isWotPlusTankRentalEnabled()57 isFreeDirectivesEnabled = serverSettings.isRenewableSubFreeDirectivesEnabled()58 with settings.wotPlusSettings() as (dt):59 dt.setEntryPointsEnabledState(isEntryPointsEnabled)60 dt.setWotPlusEnabledState(isWotPlusEnabled)61 hasSubscription = BigWorld.player().renewableSubscription.isEnabled()62 if not isWotPlusEnabled or not hasSubscription:63 return64 strategy = self._getStrategy()65 strategy.notifyClient(dt.isGoldReserveEnabled, isGoldReserveEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_GOLDRESERVE_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_GOLDRESERVE_DISABLED)66 strategy.notifyClient(dt.isPassiveXpEnabled, isPassiveXpEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_PASSIVEXP_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_PASSIVEXP_DISABLED)67 strategy.notifyClient(dt.isTankRentalEnabled, isTankRentalEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_TANKRENTAL_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_TANKRENTAL_DISABLED)68 strategy.notifyClient(dt.isFreeDirectivesEnabled, isFreeDirectivesEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_FREEDIRECTIVES_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_FREEDIRECTIVES_DISABLED)69 dt.setGoldReserveEnabledState(isGoldReserveEnabled)70 dt.setPassiveXpState(isPassiveXpEnabled)71 dt.setTankRentalState(isTankRentalEnabled)72 dt.setFreeDirectivesState(isFreeDirectivesEnabled)73 def _onServerSettingsChange(self, diff):74 if RENEWABLE_SUBSCRIPTION_CONFIG in diff:...

Full Screen

Full Screen

export.py

Source:export.py Github

copy

Full Screen

1from notifications_python_client import NotificationsAPIClient2class NotifyClient(NotificationsAPIClient):3 def __init__(self, **kwargs):4 super(NotifyClient, self).__init__(kwargs.get("api-key"))5 self.template_id: str = kwargs.get("template-id")6 self.email_reply_to_id: str = kwargs.get("reply-id")7 def send_email(self, recipient: str, **personalisation_data):8 self.send_email_notification(9 email_address=recipient,10 template_id=self.template_id,11 personalisation=personalisation_data,12 email_reply_to_id=self.email_reply_to_id,13 )14class ExportFactory:15 available_services = {"notify": NotifyClient}16 @classmethod17 def create_exporter(cls, service_name: str, **kwargs):18 exporter_class = cls.available_services[service_name]...

Full Screen

Full Screen

test-client.py

Source:test-client.py Github

copy

Full Screen

1#!/usr/bin/env python32from NotifyClient import NotifyClient3def main():4 NotifyClient().send('TEST', 'This is a testing message.')5if __name__ == '__main__':...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful