Package entropy :: Package client :: Package services :: Module interfaces :: Class RepositoryWebService

Class RepositoryWebService

source code


Nested Classes

Inherited from services.client.WebService: AuthenticationFailed, AuthenticationRequired, CacheMiss, MalformedResponse, MethodNotAvailable, MethodResponseError, RequestError, UnsupportedAPILevel, UnsupportedParameters, UnsupportedService, WebServiceException

Instance Methods
 
update_service_available(self, cache=True, cached=False)
Return whether the Web Service is supporting repositories update through the WebService.
source code
 
service_available(self, cache=True, cached=False)
Return whether the Web Service is correctly able to answer our repository-based requests.
source code
 
get_revision(self)
Return the repository revision as it's advertised remotely.
source code
 
get_repository_metadata(self)
Return the repository metadata for the selected repository.
source code
 
get_package_ids(self)
Return a list of available package identifiers in the selected repository.
source code
 
get_packages_metadata(self, package_ids)
Return a list of available package identifiers in the selected repository.
source code

Inherited from services.client.WebService: __init__, add_credentials, credentials_available, data_send_available, enable_cache_aging, get_credentials, remove_credentials, validate_credentials

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods

Inherited from services.client.WebService: config

Class Variables
  MAXIMUM_PACKAGE_REQUEST_SIZE = 10

Inherited from services.client.WebService: CACHE_DIR, PKG_ICON_IDENTIFIER, SUPPORTED_API_LEVEL, SUPPORTED_URL_SCHEMAS, WEB_SERVICE_INVALID_CREDENTIALS_CODE, WEB_SERVICE_INVALID_REQUEST_CODE, WEB_SERVICE_NOT_FOUND_CODE, WEB_SERVICE_RESPONSE_CODE_OK, WEB_SERVICE_RESPONSE_ERROR_CODE

Properties

Inherited from object: __class__

Method Details

update_service_available(self, cache=True, cached=False)

source code 
Return whether the Web Service is supporting repositories update
through the WebService. In general, this is true if service_available()
returns True, but the feature can be disabled client side through
packages.db.webservices.

@keyword cache: True means use on-disk cache if available?
@type cache: bool
@keyword cached: if True, it will only use the on-disk cached call
    result and raise WebService.CacheMiss if not found.
@type cached: bool
@return: True, if service is available
@rtype: bool

@raise WebService.RequestError: if request cannot be satisfied
@raise WebService.MethodNotAvailable: if API method is not available
    remotely and an error occurred (error code passed as exception
    argument)
@raise WebService.MalformedResponse: if JSON response cannot be
    converted back to dict.
@raise WebService.UnsupportedAPILevel: if client API and Web Service
    API do not match
@raise WebService.MethodResponseError; if method execution failed
@raise WebService.CacheMiss: if cached=True and cached object is not
    available

service_available(self, cache=True, cached=False)

source code 
Return whether the Web Service is correctly able to answer our
repository-based requests.

@keyword cache: True means use on-disk cache if available?
@type cache: bool
@keyword cached: if True, it will only use the on-disk cached call
    result and raise WebService.CacheMiss if not found.
@type cached: bool
@return: True, if service is available
@rtype: bool

@raise WebService.RequestError: if request cannot be satisfied
@raise WebService.MethodNotAvailable: if API method is not available
    remotely and an error occurred (error code passed as exception
    argument)
@raise WebService.MalformedResponse: if JSON response cannot be
    converted back to dict.
@raise WebService.UnsupportedAPILevel: if client API and Web Service
    API do not match
@raise WebService.MethodResponseError; if method execution failed
@raise WebService.CacheMiss: if cached=True and cached object is not
    available

Overrides: services.client.WebService.service_available

get_revision(self)

source code 
Return the repository revision as it's advertised remotely.
The revision is returned in string format.
Please note that this method doesn't do any caching.

@return: the repository revision
@rtype: string

@raise WebService.RequestError: if request cannot be satisfied
@raise WebService.MethodNotAvailable: if API method is not available
    remotely and an error occurred (error code passed as exception
    argument)
@raise WebService.MalformedResponse: if JSON response cannot be
    converted back to dict.
@raise WebService.UnsupportedAPILevel: if client API and Web Service
    API do not match
@raise WebService.MethodResponseError; if method execution failed

get_repository_metadata(self)

source code 
Return the repository metadata for the selected repository. It is
usually an opaque object in dict form that contains all the metadata
not related to single packages.
As for API=1, the returned metadata is the following:
"sets" => EntropyRepositoryBase.retrievePackageSets()
"treeupdates_actions" => EntropyRepositoryBase.listAllTreeUpdatesActions()
"treeupdates_digest" => EntropyRepositoryBase.retrieveRepositoryUpdatesDigest()
"revision" => <the actual repository revision, string form>
"checksum" => EntropyRepositoryBase.checksum(do_order = True,
        strict = False, include_signatures = True)
Please note that this method doesn't do any caching.

@return: the repository metadata
@rtype: dict

@raise WebService.RequestError: if request cannot be satisfied
@raise WebService.MethodNotAvailable: if API method is not available
    remotely and an error occurred (error code passed as exception
    argument)
@raise WebService.MalformedResponse: if JSON response cannot be
    converted back to dict.
@raise WebService.UnsupportedAPILevel: if client API and Web Service
    API do not match
@raise WebService.MethodResponseError; if method execution failed

get_package_ids(self)

source code 
Return a list of available package identifiers in the selected
repository.
Please note that this method doesn't do any caching.

@return: the repository metadata
@rtype: dict

@raise WebService.RequestError: if request cannot be satisfied
@raise WebService.MethodNotAvailable: if API method is not available
    remotely and an error occurred (error code passed as exception
    argument)
@raise WebService.MalformedResponse: if JSON response cannot be
    converted back to dict.
@raise WebService.UnsupportedAPILevel: if client API and Web Service
    API do not match
@raise WebService.MethodResponseError; if method execution failed

get_packages_metadata(self, package_ids)

source code 
Return a list of available package identifiers in the selected
repository.
Please note that this method doesn't do any caching.
Moreover, package_ids list cannot be longer than
RepositoryWebService.MAXIMUM_PACKAGE_REQUEST_SIZE, this is checked
both server-side, for your joy.
Data is returned in dict form, key is package_id, value is package
metadata, same you can get by calling:
EntropyRepositoryBase.getPackageData(
    package_id, content_insert_formatted = True,
    get_content = False, get_changelog = False)

@return: the repository metadata list
@rtype: dict

@raise WebService.UnsupportedParameters: if input parameters are invalid
@raise WebService.RequestError: if request cannot be satisfied
@raise WebService.MethodNotAvailable: if API method is not available
    remotely and an error occurred (error code passed as exception
    argument)
@raise WebService.MalformedResponse: if JSON response cannot be
    converted back to dict.
@raise WebService.UnsupportedAPILevel: if client API and Web Service
    API do not match
@raise WebService.MethodResponseError; if method execution failed