GalleryRemote Python package

fprimex

Joined: 2008-08-11
Posts: 3
Posted: Mon, 2008-08-11 05:19

Hi all,

I recently updated some code I found for accessing Gallery using Python. The result is the GalleryRemote package, available at my website and registered with Pypi. This is a package containing a class which implements the bulk of the Gallery Remote protocol.

I would appreciate your comments and testing. I did this work for a migration and will not be doing much more work with this package myself. Happy to fix problems and get it out of the dev status and into stable with some use by you all.

Info on my homepage:
http://www.fprimex.com/programming/galleryremote

Listing on Pypi:
http://pypi.python.org/pypi/GalleryRemote/

Install with:
easy_install GalleryRemote

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Mon, 2008-08-11 06:20

Feel free to publicize your code on this page.

--
Gallery Remote developer

 
fprimex

Joined: 2008-08-11
Posts: 3
Posted: Mon, 2008-08-11 16:13

Done, thanks. Added links to the updated Python interface on that page.

 
jmsizun

Joined: 2008-11-09
Posts: 2
Posted: Sun, 2008-11-09 11:37

Hello all,

I downloaded the librarie and suceeded to connect and fetch album and album info from my gallery2 serveur.
However, it seems the info I retrieve corresponds only to "public" info (albums and images available to guest). Is that so?
How do you take into account the authtoken described in the gallery remote protocol?

Moreover, what is the proper way to construct the URL to download a given image?

regards,

Jean-Michel

 
fprimex

Joined: 2008-08-11
Posts: 3
Posted: Tue, 2008-11-11 02:20

Hi jmsizun,

The current implementation does not handle g2_authToken, though this could be added. I've been meaning to set up Gallery1 and Gallery2 in MAMP and do some testing and further development; just haven't had time.

For my migration project, in which I connected to Gallery2, I downloaded the images with:

url = "http://your-gallery-site/gallery2"
username = 'gallery_username'
password = 'gallery_password'
gallery = Gallery2(url)
gallery.login(username, password)
images = gallery.fetch_album_images(album['name'])

for image in images:
    image_url = url + "/main.php?g2_view=core.DownloadItem&g2_itemId=" + image['name']
    opener = urllib2.build_opener(urllib2.ProxyHandler({}))
    connection = opener.open(image_url)
    image_data = connection.read()
    # do whatever with the image file data here