@@ -0,0 +1,1380 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0Alibrepo - download a package%0A%22%22%22%0A%0Aimport os%0Aimport sys%0Aimport shutil%0Afrom pprint import pprint%0A%0Aimport librepo%0A%0ADESTDIR = %22downloaded_metadata%22%0APROGRESSBAR_LEN = 40%0Afinished = False%0A%0Adef callback(data, total_to_download, downloaded):%0A    %22%22%22Progress callback%22%22%22%0A    global finished%0A%0A    if total_to_download != downloaded:%0A        finished = False%0A%0A    if total_to_download %3C= 0 or finished == True:%0A        return%0A%0A    completed = int(downloaded / (total_to_download / PROGRESSBAR_LEN))%0A    print %22%2530s: %5B%25s%25s%5D %258s/%258s%5Cr%22 %25 (data, '#'*completed, '-'*(PROGRESSBAR_LEN-completed), int(downloaded), int(total_to_download)),%0A    sys.stdout.flush()%0A%0A    if total_to_download == downloaded and not finished:%0A        print%0A        finished = True%0A        return%0A%0Aif __name__ == %22__main__%22:%0A%0A    pkgs = %5B%0A        (%22ImageMagick-djvu%22, %22Packages/i/ImageMagick-djvu-6.7.5.6-3.fc17.i686.rpm%22),%0A        (%22i2c-tools-eepromer%22, %22Packages/i/i2c-tools-eepromer-3.1.0-1.fc17.i686.rpm%22)%0A    %5D%0A%0A    h = librepo.Handle()%0A    h.setopt(librepo.LRO_URL, %22http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/%22)%0A    h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO)%0A    h.setopt(librepo.LRO_PROGRESSCB, callback)%0A    h.setopt(librepo.LRO_PROGRESSDATA, %22%22)%0A%0A    for pkg_name, pkg_url in pkgs:%0A        h.progressdata = pkg_name%0A        h.download(pkg_url)%0A%0A

Add example of downloading a package