h` dZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z mZejeZGdd e Zd ed efd ZdS) u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see N)urljoin)Request)ImunifyPatchSubscription)APIAPIError)IndependentAgentIDAPIIAIDTokenErrorcneZdZeejdZedee dee dzfdZ dS)ImunifyPatchSubscriptionAPIz/api/patch/subscriptions/checkidsreturnNcK|sgS tjd{V}n3#t$r&}td|Yd}~dSd}~wwxYwt |jtjd|i |dd} | |d{V}n3#t$r&}td|Yd}~dSd}~wwxYw|dS) zrGet active subscriptions for specific ids. Return None if interaction with the remote API failed. Nz9Can't get iaid token: %s. Return empty subscription list.userszapplication/json)zX-Authz Content-Type)dataheaderszHFailed to get subscriptions details: %s. Return empty subscription list. patchActive) r get_tokenr loggererrorrURLjsondumpsencode async_requestr)clsr tokenexcrequestresults c/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/api/imunify_patch_subscription.pyget_subscriptionsz-ImunifyPatchSubscriptionAPI.get_subscriptions'sO  I /9;;;;;;;;EE    LLK   44444   GWcN++2244$6HII     ,,W55555555FF    LL2    44444  m$$s," AA  AB22 C"<CC") __name__ __module__ __qualname__rr _BASE_URLr classmethodliststrr!r r r $sa '#-!A B BC%$s)%S D8H%%%[%%%r*r _r cLtjS)N)rselectexists)r+s r has_imunify_patch_subscriptionsr/Js # * , , 3 3 5 55r*)__doc__rlogging urllib.parserurllib.requestrimav.malwarelib.modelrdefence360agent.api.serverrrdefence360agent.internals.iaidrr getLoggerr"rr r(boolr/r)r*r r9s*  """"""::::::44444444  8 $ $#%#%#%#%#%##%#%#%L6s6t666666r*