Handle (librepo.Handle)¶
- class librepo.Handle¶
Librepo handle class. Handle hold information about a repository and configuration for downloading from the repository.
Attributes:
- update:
See:
LRO_UPDATE
- urls:
See:
LRO_URLS
- mirrorlist:
See:
LRO_MIRRORLIST
- mirrorlisturl:
See:
LRO_MIRRORLISTURL
- metalinkurl:
See:
LRO_METALINKURL
- local:
See:
LRO_LOCAL
- httpauth:
See:
LRO_HTTPAUTH
- userpwd:
See:
LRO_USERPWD
- proxy:
See:
LRO_PROXY
- proxyport:
See:
LRO_PROXYPORT
- proxytype:
See:
LRO_PROXYTYPE
- proxyauth:
See:
LRO_PROXYAUTH
- proxyuserpwd:
See:
LRO_PROXYUSERPWD
- progresscb:
See:
LRO_PROGRESSCB
- progressdata:
See:
LRO_PROGRESSDATA
- maxspeed:
See:
LRO_MAXSPEED
- destdir:
See:
LRO_DESTDIR
- repotype:
See:
LRO_REPOTYPE
- connecttimeout:
See:
LRO_CONNECTTIMEOUT
- ignoremissing:
See:
LRO_IGNOREMISSING
- interruptible:
See:
LRO_INTERRUPTIBLE
- useragent:
See:
LRO_USERAGENT
- fetchmirrors:
See:
LRO_FETCHMIRRORS
- maxmirrortries:
See:
LRO_MAXMIRRORTRIES
- maxparalleldownloads:
- maxdownloadspermirror:
- varsub:
See:
LRO_VARSUB
- fastestmirror:
See:
LRO_FASTESTMIRROR
- fastestmirrorcache:
- fastestmirrormaxage:
- fastestmirrorcb:
See:
LRO_FASTESTMIRRORCB
- fastestmirrordata:
- lowspeedtime:
See:
LRO_LOWSPEEDTIME
- lowspeedlimit:
See:
LRO_LOWSPEEDLIMIT
- gpgcheck:
See:
LRO_GPGCHECK
- checksum:
See:
LRO_CHECKSUM
- rpmmddlist:
See:
LRO_RPMMDDLIST
- yumdlist:
See:
LRO_YUMDLIST
- yumslist:
See:
LRO_YUMSLIST
- rpmmdblist:
See:
LRO_RPMMDBLIST
- yumblist:
See:
LRO_YUMBLIST
- hmfcb:
See:
LRO_HMFCB
- sslverifypeer:
- sslverifystatus:
- sslverifyhost:
- sslclientcert:
- sslclientkey:
See
LRO_SSLCLIENTKEY
- sslcacert:
See
LRO_SSLCACERT
- proxy_sslverifypeer:
- proxy_sslverifyhost:
- proxy_sslclientcert:
- proxy_sslclientkey:
- proxy_sslcacert:
- ipresolve:
See
LRO_IPRESOLVE
- allowedmirrorfailures:
- adaptivemirrorsorting:
- gnupghomedir:
See
LRO_GNUPGHOMEDIR
- fastestmirrortimeout:
- httpheader:
See
LRO_HTTPHEADER
- offline:
See
LRO_OFFLINE
- httpauthmethods¶
- proxyauthmethods¶
- ftpuseepsv¶
See
LRO_FTPUSEEPSV
- preservetime¶
See
LRO_PRESERVETIME
- download(url, dest=None, checksum_type=0, checksum=None, expectedsize=0, base_url=None, resume=0)¶
This method is deprecated - Use
download_packages()
instead.Download package from the repository specified in the
Handle
. If base_url is specified, urls and mirrors specified in the Handle are ignored.Note: If resume is True and checksum_type and checksum are specified and downloaded package already exists, then checksum of the existing package is checked. If checksum matches, then no downloading is done and exception with LRE_ALREADYDOWNLOADED return code is raised.
- Parameters
url – Relative path to the package in the repository.
dest – Destination for package. Could be absolute/relative path to directory or filename.
checksum_type – Checksum (hash) type constants.
checksum – Checksum value.
expectedsize – Expected size of the file. If server reports different size, then no download is preformed.
base_url – Instead of repositories specified in
Handle
use repository on this url.resume –
True
enables resume. Resume means that if local destination file exists, just try to resume download, if not or resume download failed than download whole file again.
Example:
h = librepo.Handle() h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO) h.download("Packages/s/sl-3.03-12.fc17.i686.rpm", checksum="0ec8535d0fc00b497d8aef491c3f8b3955f2d84846325ee44851d9de8a36d12c", checksum_type=librepo.CHECKSUM_SHA256)
Note
If checksum check is disabled in the current
Handle
, then checksum is NOT checked even if checksum and checksum_type params are specified!
- getinfo(option)¶
Get information from
Handle
.- Parameters
option – One of Handle info options
- Returns
Value for the specified option or None if the option is not set.
- new_packagetarget(relative_url, **kwargs)¶
Shortcut for creating a new
PackageTarget
objects. Targets created by this way have automatically setted handle to the currentHandle
object.- Parameters
relative_url – Relative par of target (package) URL
- Returns
New
PackageTarget
- perform(result=None)¶
Perform the specified action - download/locate a repository.
- setopt(option, val)¶
Set option to
Handle
directly.- Parameters
option – One of: Handle options
- Returns
None
Example:
# The command: h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) # is equivalent to: h.urls(["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"])