def remove_asynchronous_hash_request(host, username, password, request_id): """Performs a removeAsynchronousHashRequest operation on the given host and returns a hasherWsAsynchronousResult record with these fields: - requestId (string) - requestTime (long) - blockFileDataHandler (base64Binary) - blockFileName (string) - bytesHashed (long) - elapsedTime (long) - errorMessage (string) - filesHashed (int) - hashResult (base64Binary) - recordFileDataHandler (base64Binary) - recordFileName (string) - startTime (long) - status (string) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param request_id: a request id (string) :return: """ client = make_client(host, username, password, _service) return client.service.removeAsynchronousHashRequest(requestId=request_id)
def _hash_asynchronously(host, username, password, hasher_params): """Performs a hashAsynchronously operation on the given host with the given hasher parameters and returns a hasherWsAsynchronousResult record with these fields: - requestId (string) - requestTime (long) - blockFileDataHandler (base64Binary) - blockFileName (string) - bytesHashed (long) - elapsedTime (long) - errorMessage (string) - filesHashed (int) - hashResult (base64Binary) - recordFileDataHandler (base64Binary) - recordFileName (string) - startTime (long) - status (string) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param hasher_params: hasherWsParams :return: """ client = make_client(host, username, password, _service) return client.service.hashAsynchronously(hasherParams=hasher_params)
def get_all_asynchronous_hash_results(host, username, password): """Performs a getAllAsynchronousHashResults operation on the givne host and returns an array of hasherWsAsynchronousResult with these fields: - requestId (string) - requestTime (long) - blockFileDataHandler (base64Binary) - blockFileName (string) - bytesHashed (long) - elapsedTime (long) - errorMessage (string) - filesHashed (int) - hashResult (base64Binary) - recordFileDataHandler (base64Binary) - recordFileName (string) - startTime (long) - status (string) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :return: """ client = make_client(host, username, password, _service) return client.service.getAllAsynchronousHashResults()
def is_daemon_ready(host, username, password): '''Performs an isDaemonReady operation on the given host and returns True or False. Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) ''' client = make_client(host, username, password, _service) return client.service.isDaemonReady()
def get_au_status(host, username, password, auid): '''Performs a getAuStatus operation on the given host for the given AUID, and returns a record with these fields (or None if zeep.exceptions.Fault with 'No Archival Unit with provided identifier' is raised): - accessType (string) - availableFromPublisher (boolean) - contentSize (numeric) - crawlPool (string) - crawlProxy (string) - crawlWindow (string) - creationTime (numeric) - currentlyCrawling (boolean) - currentlyPolling (boolean) - diskUsage (numeric) - journalTitle (string) - lastCompletedCrawl (numeric) - lastCompletedPoll (numeric) - lastCrawl (numeric) - lastCrawlResult (string) - lastCompletedDeepCrawl (numeric) - lastDeepCrawl (numeric) - lastDeepCrawlResult (string) - lastCompletedDeepCrawlDepth (numeric) - lastPoll (numeric) - lastPollResult (string) - lastMetadataIndex (numeric) - pluginName (string) - provider (string) - publisher (string) - publishingPlatform (string) - recentPollAgreement (floating point) - repository (string) - status (string) - subscriptionStatus (string) - substanceState (string) - volume (string) (the AU name) - year (string) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param auid: an auid to hash (string) ''' client = make_client(host, username, password, _service) try: ret = client.service.getAuStatus(auId=auid) return zeep.helpers.serialize_object(ret) except zeep.exceptions.Fault as e: if e.message == 'No Archival Unit with provided identifier': return None else: raise
def query_crawls(host, username, password, select, where=None): '''Performs a queryCrawls operation on the given host, using the given field names to build a SELECT clause, optionally using the given string to build a WHERE clause, and returns a list of records with these fields (populated or not depending on the SELECT clause): - auId (string) - auName (string) - bytesFetchedCount (long) - crawlKey (string) - crawlStatus (string) - crawlType (string) - duration (long) - linkDepth (int) - mimeTypeCount (int) - mimeTypes (list of strings) - offSiteUrlsExcludedCount (int) - pagesExcluded (list of strings) - pagesExcludedCount (int) - pagesFetched (list of strings) - pagesFetchedCount (int) - pagesNotModified (list of strings) - pagesNotModifiedCount (int) - pagesParsed (list of strings) - pagesParsedCount (int) - pagesPending (list of strings) - pagesPendingCount (int) - pagesWithErrors, a list of records with these fields: - message (string) - severity (string) - url (string) - pagesWithErrorsCount (int) - refetchDepth (int) - sources (list of strings) - startTime (long) - startingUrls (list of strings) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param select: if a list of strings, the field names to be used in the SELECT clause; if a string, the single field name to be used in the SELECT clause (string or list of strings) :param where : optional statement for the WHERE clause (string, default: None) Raises: - ValueError if select is not of the right type ''' query = construct_query(select, where) client = make_client(host, username, password, _service) ret = client.service.queryCrawls(crawlQuery=query) return zeep.helpers.serialize_object(ret)
def get_auids(host, username, password): '''Performs a getAuIds operation on the given host, which really produces a sequence of all AUIDs with the AU names, and returns a list of records with these fields: - id (string) - name (string) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) ''' client = make_client(host, username, password, _service) ret = client.service.getAuIds() return zeep.helpers.serialize_object(ret)
def get_au_urls(host, username, password, auid, prefix=None): '''Performs a getAuUrls operation on the given host for the given AUID and returns a list of URLs (strings) in the AU. If the optional prefix argument is given, limits the results to URLs with that prefix (including the URL itself). Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param auid: an auid to hash (string) :param prefix: a URL prefix (string, default: None) ''' client = make_client(host, username, password, _service) ret = client.service.getAuUrls(auId=auid, url=prefix) return ret
def add_aus_by_id_list(host, username, password, auids): ''' Performs an addAusByIdList operation (which adds all given AUs on a single host, by AUID), and returns a list of records with these fields: - id (string): the AUID - isSuccess (boolean): a success flag - message (string): an error message - name (string): the AU name Parameters: - host (string): a host:port pair - username (string): a username for the host - password (string): a password for the host - auids (list of strings): a list of AUIDs ''' client = make_client(host, username, password, _service) return client.service.addAusByIdList(auIds=auids)
def deactivate_au_by_id(host, username, password, auid): ''' Performs a deactivateAuById operation (which deactivates a single AU on a single host, by AUID), and returns a record with these fields: - id (string): the AUID - isSuccess (boolean): a success flag - message (string): an error message - name (string): the AU name Parameters: - host (string): a host:port pair - username (string): a username for the host - password (string): a password for the host - auid (string): an AUID ''' client = make_client(host, username, password, _service) return client.service.deactivateAuById(auId=auid)
def create_export_files(host, username, password, auid, options): '''Performs a createExportFiles operation on the given host for the given AUID, and returns a record with the files. Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param auid: an auid to hash (string) Returns: - ret (dict): { 'auId': '<auid>', 'dataHandlerWrappers': [ { 'dataHandler' (base64Binary): zipped AU 'name' (string): '<prefix>-<timestamp>-<5 digit id>.zip', 'size' (long): size of dataHandler in bytes } ] } ''' req = { 'auid': auid, 'compress': options.compress, 'excludeDirNodes': options.exclude_dir, 'filePrefix': options.output_prefix, 'fileType': options.file_type, 'maxSize': options.max_size, 'maxVersions': options.max_vers, 'xlateFilenames': options.translate } client = make_client(host, username, password, _service) try: ret = client.service.createExportFiles(req) return zeep.helpers.serialize_object(ret) except zeep.exceptions.Fault as e: if e.message == 'No Archival Unit with provided identifier': return None else: raise
def get_platform_configuration(host, username, password): '''Performs a getPlatformConfiguration operation on the given host and returns a record with these fields: - adminEmail (string) - buildHost (string) - buildTimestamp (numeric) - currentTime (numeric) - currentWorkingDirectory (string) - daemonVersion, a record with these fields: - buildVersion (numeric) - fullVersion (string) - majorVersion (numeric) - minorVersion (numeric) - disks (list of strings) - groups (list of strings) - hostName (string) - ipAddress (string) - javaVersion, a record with these fields: - runtimeName (string) - runtimeVersion (string) - specificationVersion (string) - version (string) - mailRelay (string) - platform, a record with these fields: - name (string) - suffix (string) - version (string) - project (string) - properties (list of strings) - uptime (numeric) - v3Identity (string) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) ''' client = make_client(host, username, password, _service) return zeep.helpers.serialize_object( client.service.getPlatformConfiguration())
def query_tdb_titles_by_auid(host, username, password, auid, select="*"): '''Performs a queryTdbTitles operation on the given host for the given auid, and returns an list of records with these fields (populated or not depending on the SELECT clause): - EIssn (string) - id (string) - issn (string) - issnL (string) - issns (string) - name (string) - printIssn (string) - proprietaryId (string) - proprietaryIds (string) - publicationType (string) - tdbPublisher (tns:tdbPublisherWsResult) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param auid: an auid to hash (string) :param select: if a list of strings, the field names to be used in the SELECT clause; if a string, the single field name to be used in the SELECT clause (string or list of strings) Raises: - ValueError if auid or select is not of the right type ''' client = make_client(host, username, password, _service) query = construct_query(select) try: # first we get the publisher given the auid and filter the query au_journal = client.service.getAuStatus(auId=auid)['journalTitle'] query += " WHERE name={}".format(repr(au_journal)) ret = client.service.queryTdbTitles(tdbTitleQuery=query) return zeep.helpers.serialize_object(ret) except zeep.exceptions.Fault as e: if e.message == 'No Archival Unit with provided identifier': return None else: raise
def query_aus(host, username, password, select, where=None): '''Performs a queryAus operation on the given host, using the given field names to build a SELECT clause, optionally using the given string to build a WHERE clause, and returns a list of records with these fields (populated or not depending on the SELECT clause): - accessType (string) - articleUrls (list of strings) - auConfiguration, a record with these fields: - defParams, a list of records with these fields: - key (string) - value (string) - nonDefParams, a list of records with these fields: - key (string) - value (string) - auId (string) - availableFromPublisher (boolean) - contentSize (numeric) - crawlPool (string) - crawlProxy (string) - crawlWindow (string) - creationTime (numeric) - currentlyCrawling (boolean) - currentlyPolling (boolean) - diskUsage (numeric) - highestPollAgreement (numeric) - isBulkContent (boolean) - journalTitle (string) - lastCompletedCrawl (numeric) - lastCompletedPoll (numeric) - lastCrawl (numeric) - lastCrawlResult (string) - lastCompletedDeepCrawl (numeric) - lastDeepCrawl (numeric) - lastDeepCrawlResult (string) - lastCompletedDeepCrawlDepth (numeric) - lastPoll (numeric) - lastPollResult (string) - lastMetadataIndex (numeric) - name (string) - newContentCrawlUrls (list of strings) - peerAgreements, a list of records with these fields: - agreements, a record with these fields: - entry, a list of records with these fields: - key, a string among: - "POR" - "POP" - "SYMMETRIC_POR" - "SYMMETRIC_POP" - "POR_HINT" - "POP_HINT" - "SYMMETRIC_POR_HINT" - "SYMMETRIC_POP_HINT" - "W_POR" - "W_POP" - "W_SYMMETRIC_POR" - "W_SYMMETRIC_POP" - "W_POR_HINT" - "W_POP_HINT" - "W_SYMMETRIC_POR_HINT" - "W_SYMMETRIC_POP_HINT" - value, a record with these fields: - HighestPercentAgreement (floating point) - HighestPercentAgreementTimestamp (numeric) - PercentAgreement (floating point) - PercentAgreementTimestamp (numeric) - peerId (string) - pluginName (string) - publishingPlatform (string) - recentPollAgreement (numeric) - repositoryPath (string) - subscriptionStatus (string) - substanceState (string) - tdbProvider (string) - tdbPublisher (string) - tdbYear (string) - urlStems (list of strings) - urls, a list of records with these fields: - currentVersionSize (numeric) - url (string) - versionCount (numeric) - volume (string) Parameters: :param host: a host:port pair (string) :param username: a username for the host (string) :param password: a password for the host (string) :param select: if a list of strings, the field names to be used in the SELECT clause; if a string, the single field name to be used in the SELECT clause (string or list of strings) :param where : optional statement for the WHERE clause (string, default: None) Raises: - ValueError if select is not of the right type ''' query = construct_query(select, where) client = make_client(host, username, password, _service) ret = client.service.queryAus(auQuery=query) return zeep.helpers.serialize_object(ret)
def request_crawl_by_id(host, username, password, auid, priority, force): client = make_client(host, username, password, _service) return zeep.helpers.serialize_object( client.service.requestCrawlById(auId=auid, priority=priority, force=force))
def request_crawl_by_id_list(host, username, password, auids, priority, force): client = make_client(host, username, password, _service) return client.service.requestCrawlByIdList(auIds=auids, priority=priority, force=force)
def request_deep_crawl_by_id_list(host, username, password, auids, refetch_depth, priority, force): client = make_client(host, username, password, _service) return client.service.requestDeepCrawlByIdList( auIds=auids, refetchDepth=refetch_depth, priority=priority, force=force)