arde en el infierno

Octubre 4th, 2007

SnipplrPy

Posted by arcturus in General

Download: SnipplrPy-0.4.tar.gz

Description:

SnipplrPy is a class written in Python to support all the functionalities offered by the great service snipplr.com through xml-rpc.

It covers all functions in snipplr api, plus other usefull features such as posting file contents and retrieving plain source code.

Requirements:

This class works on any system running Python 2.4 or newer. A snipplr api key is needed if you want use user functionalities like posting or deleting snippets.

Screenshots:

SnipplrPy ScreenShot 1 screenshoot2 screenshoot3

Installation:

Download the file, uncompress it and:

sudo python setup.py install

Examples:

Configuration
CODE:
  1. from SnipplrPy import *
  2. snipplr = SnipplrPy()
  3. snipplr.setup("your api key code")
Getting some plugins by tag
CODE:
  1. snippets = snipplr.list("python")
  2.  
  3. for snippet in snippets:
  4.  
  5. print snippet["id"]
  6.  
  7. print snippet["title"]
  8.  
  9. print snippet["source"]
Posting and deleting a snippet
CODE:
  1. src="""print "Hello World!\n""""
  2.  
  3. snipplr.post("Hello world python", src, "python programming simple")
  4.  
  5. snipplr.delete(1273) 
Posting a whole file and getting plain source code
CODE:
  1. snipplr.post_file("/usr/local/src/code.py","Simple python snippet","python simple")
  2.  
  3. src = snipplr.get_source_plain_text(1273)

License:

SnipplrPy.py -- Snipplr Python Wrapper

Copyright (C) 2007 - Francisco Jesús Jordano Jiménez <arcturus@ardeenelinfierno.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Some ideas and code taken from Avinash Vora (http://www.avinashv.net/) and
his tool SnipplrCLI (http://www.avinashv.net/snipplrcli/)

4 Responses to ' SnipplrPy '

Subscribe to comments with RSS or TrackBack to ' SnipplrPy '.

  1. ross said,

    on Octubre 9th, 2007 at 8:58 am

    It’s so cool the new look of your blog!! i like it so much. Congratulations!!There’s a good idea the plugin. Carry on creating! :D Love u!


  2. on Noviembre 18th, 2008 at 11:14 am

    Hi!

    Can I please use you’r API for my new project? I want to make simple and fast cross-platform python based (GTK/Glade) GUI for Snipplr.

    Please contact me!
    Oto Brglez

  3. arcturus said,

    on Noviembre 21st, 2008 at 3:09 pm

    Hi Oto

    Please feel free to use, reuse, rewrite, learn or whatever you want to do with this piece of shared knowledge :D

    Thanks,
    Francisco.

  4. hemanth.hm said,

    on Marzo 18th, 2009 at 3:05 pm

    Good work :)
    I liked the regular expression and the end ;)

Leave a reply


*
To prove you're a person (not a spam script), type the answer to the math equation shown in the picture. Click on the picture to hear an audio file of the equation.
Click to hear an audio file of the anti-spam equation