"""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": 53, "limit": 530, "responseCode": 200, "count": 982, "data": [{"id": 76, "flags": ["DENY_SUBMIT_FOR_OTHER_USER"], "name": "Emily Mcdaniel", "shortName": "Affect law technology sound son.", "properties": {"additionalProperties": "Skill here factor build soldier door."}, "services": [{"id": 301, "name": "Laura Martin", "description": "Power again foreign before like enjoy become."}], "createdByUser": {"id": 695, "customerID": 722, "userName": "michaelmitchell", "name": "Christopher Johns"}, "createdTimestamp": 1278844909, "lastUpdatedByUser": {"id": 190, "customerID": 573, "userName": "josephvanessa", "name": "Barbara Chavez"}, "accountManager": {"id": 740, "customerID": 249, "userName": "marymedina", "name": "Rachel Powell"}, "lastUpdatedTimestamp": 567049493, "language": "ENGLISH"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Especially it sometimes score garden board.", "messageTemplate": "Clear leg rock though health.", "field": "Image officer see chance.", "parameter": {}, "timestamp": 1103028302}], "currentPage": 839, "size": 508}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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": 816, "limit": 980, "responseCode": 200, "count": 432, "metaData": {"additionalProperties": {}}, "messages": [{"message": "No ground new police call mean.", "messageTemplate": "Whatever crime deal outside about assume medical.", "field": "Adult and game measure edge put technology.", "parameter": {}, "timestamp": 646362498}], "currentPage": 838, "size": 14}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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": 744, "limit": 94, "responseCode": 200, "count": 192, "data": [{"id": 272, "flags": ["DENY_SUBMIT_FOR_OTHER_USER"], "name": "Thomas Perez", "shortName": "Particularly I wife really financial.", "properties": {"additionalProperties": "Answer top at throughout book."}, "services": [{"id": 155, "name": "Alvin Moon", "description": "Effect piece admit many participant actually."}], "createdByUser": {"id": 487, "customerID": 788, "userName": "james23", "name": "Ashley Mendoza"}, "createdTimestamp": 1302122335, "lastUpdatedByUser": {"id": 293, "customerID": 160, "userName": "moraleslisa", "name": "Loretta Jennings"}, "accountManager": {"id": 534, "customerID": 330, "userName": "jamesweaver", "name": "Lauren King"}, "lastUpdatedTimestamp": 116366020, "language": "NORWEGIAN"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Business enter network guess.", "messageTemplate": "Fly camera news some live.", "field": "Hour senior recent day community reduce.", "parameter": {}, "timestamp": 639938189}], "currentPage": 68, "size": 231}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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": 68, "limit": 523, "responseCode": 200, "count": 945, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Right find herself fine set.", "messageTemplate": "Nearly everybody after sing.", "field": "Event side develop.", "parameter": {}, "timestamp": 547241580}], "currentPage": 130, "size": 655}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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": 953, "limit": 742, "responseCode": 200, "count": 371, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Keep western star speak leg.", "messageTemplate": "Look room beautiful thus.", "field": "Occur everybody quality structure effect.", "parameter": {}, "timestamp": 14694556}], "currentPage": 87, "size": 923}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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": 2, "limit": 560, "responseCode": 200, "count": 489, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Avoid nothing the memory different.", "messageTemplate": "Present yourself hold.", "field": "Baby and main crime.", "parameter": {}, "timestamp": 686513327}], "currentPage": 771, "size": 203}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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": 750, "limit": 414, "responseCode": 200, "count": 394, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Say like really loss difference including.", "messageTemplate": "Laugh address west hard town.", "field": "Behind usually property off arm card expert.", "parameter": {}, "timestamp": 375010370}], "currentPage": 376, "size": 55}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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": 441, "limit": 239, "responseCode": 200, "count": 597, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Image worry put Mrs quality.", "messageTemplate": "To out see.", "field": "Piece agreement difficult.", "parameter": {}, "timestamp": 536529158}], "currentPage": 168, "size": 695}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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://osl-argus-trunk-web1.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": 593, "limit": 335, "responseCode": 200, "count": 16, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Important somebody material subject.", "messageTemplate": "Economy before them stand week language.", "field": "His better crime well.", "parameter": {}, "timestamp": 849716569}], "currentPage": 376, "size": 171}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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://osl-argus-trunk-web1.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