"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('customers','v1','customer'))
def list_customers(parentID: list = None, service: list = None, keywords: list = None, keywordField: list = None, sortBy: list = None, offset: int = 0, limit: int = 25, keywordMatch: str = 'all',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns customers defined by query parameters (PUBLIC)
:param list parentID: Search by parentID
:param list service: Search by services
:param list keywords: Search by keywords
:param list keywordField: Set field strategy for keyword search
:param list sortBy: Sort search result
:param int offset: Skip a number of results
:param int limit: Maximum number of returned results
:param str keywordMatch: Set match strategy for keyword search
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 780, "limit": 329, "responseCode": 200, "count": 29, "data": [{"id": 764, "flags": ["INITIAL_TUNING"], "name": "Kimberly Schultz", "shortName": "Station win individual dream himself trip.", "properties": {"additionalProperties": "Music physical magazine yes summer which."}, "services": [{"id": 41, "name": "Adrian Thompson", "description": "Break yet feeling TV piece throw."}], "createdByUser": {"id": 268, "customerID": 515, "userName": "walkerkimberly", "name": "Louis Weber"}, "createdTimestamp": 13736734, "lastUpdatedByUser": {"id": 490, "customerID": 578, "userName": "stephaniewoods", "name": "Caroline Turner"}, "accountManager": {"id": 813, "customerID": 234, "userName": "ebarnes", "name": "Richard Gomez"}, "lastUpdatedTimestamp": 290130034, "language": "NORWEGIAN"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "As deep usually goal.", "messageTemplate": "Wide house develop wish degree single set.", "field": "Mission TV give country.", "parameter": {}, "timestamp": 694698937}], "currentPage": 526, "size": 982}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
if offset:
body.update({"offset": offset})
if limit:
body.update({"limit": limit})
if keywordMatch:
body.update({"keywordMatch": keywordMatch})
if parentID:
body.update({"parentID": parentID})
if service:
body.update({"service": service})
if keywords:
body.update({"keywords": keywords})
if keywordField:
body.update({"keywordField": keywordField})
if sortBy:
body.update({"sortBy": sortBy})
response = get(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def add_customer(name: str = None, shortName: str = None, properties: dict = None, logoURL: str = None, accountManagerID: int = None, features: list = None, language: str = 'ENGLISH', timeZone: str = 'Europe/Oslo', type: str = 'CUSTOMER', parentID: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Create a new customer (PUBLIC)
:param str name: Name to set for new customer. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str shortName: shortName to set for new customer (must be unique). => [a-zA-Z0-9_\-\.]*
:param dict properties: Properties to set for customer. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str logoURL: Customer logo data url. On format data:image/jpeg;base64,BASE64STRING. => Sanitize by regex data:.*
:param int accountManagerID: ID of account manager to assign to customer. If not set, no account manager is set.
:param list features: Features to enable on customer.
:param str language: Language to set for customer. (default ENGLISH)
:param str timeZone: Name of timezone to set for customer. (default Europe/Oslo)
:param str type: Object type. If set to GROUP, this customer can have subcustomers. (default CUSTOMER)
:param int parentID: ID of parent customer group to add this customer to. (default 0)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 740, "limit": 719, "responseCode": 200, "count": 588, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Early pay weight skin future story last.", "messageTemplate": "Matter expert whether foot indicate her.", "field": "Focus defense find base son name of.", "parameter": {}, "timestamp": 384602930}], "currentPage": 640, "size": 696}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
if language:
body.update({"language": language})
if timeZone:
body.update({"timeZone": timeZone})
if type:
body.update({"type": type})
if parentID:
body.update({"parentID": parentID})
if name:
body.update({"name": name})
if shortName:
body.update({"shortName": shortName})
if properties:
body.update({"properties": properties})
if logoURL:
body.update({"logoURL": logoURL})
if accountManagerID:
body.update({"accountManagerID": accountManagerID})
if features:
body.update({"features": features})
response = post(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def search_customers(limit: int = None, offset: int = None, subCriteria: list = None, customerID: list = None, parentID: list = None, keywords: list = None, keywordMatchStrategy: str = None, keywordFieldStrategy: list = None, service: list = None, domain: list = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns customers defined by CustomerSearchCriteria (PUBLIC)
:param int limit: Set this value to set max number of results. By default, no restriction on result set size.
:param int offset: Set this value to skip the first (offset) objects. By default, return result from first object.
:param list subCriteria:
:param list customerID: Restrict search to data belonging to specified customers.
:param list parentID: Search for customers by parent customer ID.
:param list keywords: Search for customers by keywords.
:param str keywordMatchStrategy: Defines the MatchStrategy for keywords (default match all keywords).
:param list keywordFieldStrategy: Defines which fields will be searched by keywords (default all supported fields).
:param list service: Search for customers having any of these services (service shortname).
:param list domain: Search for customers in one of these domains (by domain id or name).
:param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
:param list includeFlags: Only include objects which have includeFlags set.
:param list excludeFlags: Exclude objects which have excludeFlags set.
:param bool includeDeleted: Set to true to include deleted objects. By default, exclude deleted objects.
:param bool exclude: Only relevant for subcriteria. If set to true, objects matching this subcriteria object will be excluded.
:param bool required: Only relevant for subcriteria. If set to true, objects matching this subcriteria are required (AND-ed together with parent criteria).
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 134, "limit": 221, "responseCode": 200, "count": 70, "data": [{"id": 956, "flags": ["ALLOW_API"], "name": "Daniel Mccall", "shortName": "Sure popular thank already career its name participant.", "properties": {"additionalProperties": "Yeah interesting nature exist."}, "services": [{"id": 475, "name": "Jacob Powell II", "description": "Believe should likely information."}], "createdByUser": {"id": 673, "customerID": 75, "userName": "owalker", "name": "Christina Ho"}, "createdTimestamp": 1384499907, "lastUpdatedByUser": {"id": 12, "customerID": 658, "userName": "andersoneric", "name": "Robert Armstrong"}, "accountManager": {"id": 394, "customerID": 701, "userName": "beth18", "name": "Jennifer Perry"}, "lastUpdatedTimestamp": 912542602, "language": "ENGLISH"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "According performance national protect.", "messageTemplate": "According why during meet.", "field": "Sure author difficult.", "parameter": {}, "timestamp": 1424562099}], "currentPage": 708, "size": 144}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/search".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
if limit:
body.update({"limit": limit})
if offset:
body.update({"offset": offset})
if includeDeleted:
body.update({"includeDeleted": includeDeleted})
if subCriteria:
body.update({"subCriteria": subCriteria})
if exclude:
body.update({"exclude": exclude})
if required:
body.update({"required": required})
if customerID:
body.update({"customerID": customerID})
if parentID:
body.update({"parentID": parentID})
if keywords:
body.update({"keywords": keywords})
if keywordMatchStrategy:
body.update({"keywordMatchStrategy": keywordMatchStrategy})
if keywordFieldStrategy:
body.update({"keywordFieldStrategy": keywordFieldStrategy})
if service:
body.update({"service": service})
if domain:
body.update({"domain": domain})
if sortBy:
body.update({"sortBy": sortBy})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
response = post(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def add_customer_service(customerID: int, service: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Add a service to a customer. (PUBLIC)
:param int customerID: Customer ID
:param str service: Name of service to enable on customer
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 463, "limit": 997, "responseCode": 200, "count": 599, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Tv reach know most.", "messageTemplate": "Nothing share standard town.", "field": "Age ever case parent attack stand apply.", "parameter": {}, "timestamp": 134136427}], "currentPage": 946, "size": 764}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{customerID}/service".format(customerID=customerID)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
if service:
body.update({"service": service})
response = post(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def remove_customer_service(customerID: int, service: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Remove a service from a customer. (PUBLIC)
:param int customerID: Customer ID
:param str service: Name of service to remove
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 507, "limit": 370, "responseCode": 200, "count": 524, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Knowledge reach girl everybody again recognize act.", "messageTemplate": "Line community relate base cost scene.", "field": "Assume whatever season eye catch trip population.", "parameter": {}, "timestamp": 1201674967}], "currentPage": 473, "size": 982}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{customerID}/service/{service}".format(customerID=customerID, service=service)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = delete(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def get_customer_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns a Customer identified by its ID. (PUBLIC)
:param int id: Customer ID
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 329, "limit": 943, "responseCode": 200, "count": 251, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Politics similar inside dark.", "messageTemplate": "Alone blue help fact usually.", "field": "Project lead ask together tax general.", "parameter": {}, "timestamp": 1441469954}], "currentPage": 500, "size": 733}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{id}".format(id=id)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = get(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def update_customer(id: int, name: str = None, shortName: str = None, language: str = None, addProperties: dict = None, deleteProperties: list = None, logoURL: str = None, timeZone: str = None, accountManagerID: int = None, addFeatures: list = None, deleteFeatures: list = None, type: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Update a customer object. (PUBLIC)
:param int id: Customer ID
:param str name: If set, change customer name to this value. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str shortName: If set, change customer shortname to this value (must be unique). => [a-zA-Z0-9_\-\.]*
:param str language: If set, change customer language.
:param dict addProperties: If set, add these properties. If the keys exist, they will be overwritten. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list deleteProperties: If set, remove properties with these keys. Missing keys are ignored.
:param str logoURL: If set, change customer logo. On format data:image/jpeg;base64,BASE64STRING. => Sanitize by regex data:.*
:param str timeZone: If set, change customer timezone to timezone with this name.
:param int accountManagerID: If set, change customer account manmager to specified user.
:param list addFeatures: If set, add these features to customer.
:param list deleteFeatures: If set, remove these features from customer.
:param str type: Customer type. If set to GROUP, this customer can have subcustomers.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 250, "limit": 545, "responseCode": 200, "count": 705, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Rest car short present.", "messageTemplate": "No expert air tell wall.", "field": "Full cup tree.", "parameter": {}, "timestamp": 427920083}], "currentPage": 910, "size": 165}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{id}".format(id=id)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
if name:
body.update({"name": name})
if shortName:
body.update({"shortName": shortName})
if language:
body.update({"language": language})
if addProperties:
body.update({"addProperties": addProperties})
if deleteProperties:
body.update({"deleteProperties": deleteProperties})
if logoURL:
body.update({"logoURL": logoURL})
if timeZone:
body.update({"timeZone": timeZone})
if accountManagerID:
body.update({"accountManagerID": accountManagerID})
if addFeatures:
body.update({"addFeatures": addFeatures})
if deleteFeatures:
body.update({"deleteFeatures": deleteFeatures})
if type:
body.update({"type": type})
response = put(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def disable_customer(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Disable customer. (PUBLIC)
:param int id: Customer ID
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 387, "limit": 791, "responseCode": 200, "count": 609, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Rich director animal.", "messageTemplate": "This between continue with decision operation.", "field": "Music this pretty let.", "parameter": {}, "timestamp": 1386429872}], "currentPage": 260, "size": 551}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{id}".format(id=id)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = delete(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def get_customer_logo_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns a Customer logo by customer shortname. (PUBLIC)
:param int id: Customer ID
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{id}/logo".format(id=id)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = get(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def get_customer_by_shortname(shortName: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns a Customer identified by its shortname. (PUBLIC)
:param str shortName: Customer shortname
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 189, "limit": 678, "responseCode": 200, "count": 475, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Its several peace including.", "messageTemplate": "Appear successful my family as argue want.", "field": "Model learn current six.", "parameter": {}, "timestamp": 1108116474}], "currentPage": 671, "size": 621}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{shortName}".format(shortName=shortName)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = get(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response
[docs]@register_command(extending=('customers','v1','customer'))
def get_customer_logo_by_shortname(shortName: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns a Customer logo by customer shortname. (PUBLIC)
:param str shortName: Customer shortname
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customers/v1/customer/{shortName}/logo".format(shortName=shortName)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = get(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response