Source code for api.customers.v1.customer

"""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": 407, "limit": 770, "responseCode": 200, "count": 492, "data": [{"id": 138, "flags": ["DISABLED"], "name": "Jeffery Ellis", "shortName": "Tree poor window sure change lose short.", "properties": {"additionalProperties": "Data stop check pretty spend."}, "services": [{"id": 556, "name": "Abigail Torres", "description": "Majority address mind true big cut."}], "createdByUser": {"id": 102, "customerID": 140, "userName": "kathleenhanson", "name": "Michelle Anderson"}, "createdTimestamp": 713403366, "lastUpdatedByUser": {"id": 196, "customerID": 916, "userName": "wwatson", "name": "Brian Pratt"}, "accountManager": {"id": 456, "customerID": 125, "userName": "lawrencenewton", "name": "Alexis Sandoval"}, "lastUpdatedTimestamp": 816446285, "language": "ENGLISH"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Because relate international understand billion war.", "messageTemplate": "Authority white hair stay foot century.", "field": "Team him treat lay sense.", "parameter": {}, "timestamp": 145581532}], "currentPage": 492, "size": 525} """ 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, excludeFromProduction: bool = 'False',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) :param bool excludeFromProduction: Mark customer as excluded from production. (default false) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 122, "limit": 248, "responseCode": 200, "count": 151, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Federal major have need attorney foreign especially.", "messageTemplate": "Where it throughout oil.", "field": "People argue series performance dinner cause.", "parameter": {}, "timestamp": 192731732}], "currentPage": 992, "size": 537} """ 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}) if excludeFromProduction: body.update({"excludeFromProduction": excludeFromProduction}) 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": 499, "limit": 319, "responseCode": 200, "count": 182, "data": [{"id": 639, "flags": ["ALLOW_MAIL_UPDATES"], "name": "Jennifer Hurst", "shortName": "Nearly keep next hair.", "properties": {"additionalProperties": "Citizen blood give."}, "services": [{"id": 399, "name": "Edward Freeman", "description": "Station tough sell century radio."}], "createdByUser": {"id": 868, "customerID": 429, "userName": "matthew55", "name": "Rebecca George"}, "createdTimestamp": 601974624, "lastUpdatedByUser": {"id": 975, "customerID": 13, "userName": "elizabethyoung", "name": "Jennifer Holt"}, "accountManager": {"id": 194, "customerID": 773, "userName": "swagner", "name": "Emily Taylor"}, "lastUpdatedTimestamp": 899105483, "language": "NORWEGIAN"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Hour along public party wonder head discussion.", "messageTemplate": "He shoulder knowledge management.", "field": "Hard smile put large information into.", "parameter": {}, "timestamp": 239493757}], "currentPage": 957, "size": 128} """ 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": 756, "limit": 544, "responseCode": 200, "count": 800, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Choose law call quality upon.", "messageTemplate": "Not certainly wonder interview mean.", "field": "Serve reflect can key father service.", "parameter": {}, "timestamp": 1319149462}], "currentPage": 640, "size": 43} """ 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": 778, "limit": 959, "responseCode": 200, "count": 132, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Weight human win ahead.", "messageTemplate": "Her heavy better.", "field": "Education Mr skill.", "parameter": {}, "timestamp": 1271176969}], "currentPage": 24, "size": 487} """ 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": 609, "limit": 147, "responseCode": 200, "count": 572, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Kid myself magazine dog popular everyone paper message.", "messageTemplate": "Somebody expert suggest past once cover field leg.", "field": "Pay point even various necessary mind catch.", "parameter": {}, "timestamp": 106395979}], "currentPage": 888, "size": 286} """ 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, excludeFromProduction: bool = 'False',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. :param bool excludeFromProduction: If set, enable/disable customer as excluded from production :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 888, "limit": 813, "responseCode": 200, "count": 778, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Artist author kid democratic run.", "messageTemplate": "Act quickly represent walk.", "field": "Middle investment next watch leave board.", "parameter": {}, "timestamp": 1441328791}], "currentPage": 501, "size": 283} """ 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}) if excludeFromProduction: body.update({"excludeFromProduction": excludeFromProduction}) 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": 556, "limit": 634, "responseCode": 200, "count": 301, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Focus should red once.", "messageTemplate": "Take can conference blue floor.", "field": "Suffer doctor appear charge citizen.", "parameter": {}, "timestamp": 265461878}], "currentPage": 602, "size": 606} """ 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 reenable_customer(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Reenable customer. (INTERNAL) :param int id: Customer ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 505, "limit": 157, "responseCode": 200, "count": 234, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Tax eat term especially risk data.", "messageTemplate": "Stand low husband go total focus line.", "field": "Buy field certainly your sense author attack protect.", "parameter": {}, "timestamp": 96152177}], "currentPage": 317, "size": 679} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customers/v1/customer/{id}/reenable".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 = 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 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": 363, "limit": 928, "responseCode": 200, "count": 84, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Number career growth suddenly our stop.", "messageTemplate": "For party account myself whether practice system.", "field": "Be old relationship evening natural deep have.", "parameter": {}, "timestamp": 693239719}], "currentPage": 643, "size": 969} """ 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