GithubHelp home page GithubHelp logo

wd5 / posterous-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from benjmin-r/posterous-python

0.0 2.0 0.0 123 KB

A wrapper for the posterous API, written in python

Home Page: http://nureineide.posterous.com/tag/posterous-python

License: MIT License

posterous-python's Introduction

What is posterous-python?

It's a simple to use Python library for version 1 of the Posterous API. It covers the entire API and it's really easy to extend when new API methods are added! Support for API v2 will be added soon.

Getting started

  • Check out the posterous-python source code using git: git clone git://github.com/nureineide/posterous-python.git
  • Run setuptools to install sudo python setup.py install

That's it! Now run the posterous-shell to start playing with the library.

##Sample usage import posterous

api = posterous.API('username', 'password')

# Get the user's sites
sites = api.get_sites()

for site in sites:
    print site.name

# Get all of the posts from the first site
for post in api.read_posts(id=sites[0].id):
    print '%s (%s)' % (post.title, post.url)
    print '  - written by %s' % post.author

    if post.commentsenabled:
        print '  - has %s comment(s)' % post.commentscount
        
        if post.commentscount > 0:
            print '  - comments:'
            for comment in post.comments:
                print '    - "%s" by %s' % (comment.body, comment.author)

    if hasattr(post, 'media'):
        print '  - media:'
        for media in post.media:
            print '    - %s' % media.url

    print '\n'


# Create a new post with an image
image = open("jellyfish.png", "rb").read()
post = api.new_post(title="I love Posterous", body="Do you love it too?", media=image)

# Add a comment
post.new_comment("This is a really interesting post.")

Until there is full documentation coverage, you can take a look at api.py for the available methods and their arguments. The model objects also have methods that allow you to quickly perform actions (i.e. post.new_comment() instead of api.read_posts()[0].new_comment()), so look at models.py for those.

##In the future... Expect to see these new features:

  • Easy pagination for iterating over large result sets
  • Response caching
  • Full documentation
  • A cool script for backing up a Posterous site

##Last words The design of this library was very much inspired by Tweepy. Tweepy is an excellent Python wrapper for Twitter's API, so give it a look if you're working with Twitter.

###License http://www.apache.org/licenses/LICENSE-2.0 - See LICENSE for more details.

Copyright (c) 2010 Benjamin Reitzammer <nureineide>

###Credits Michael Campagnaro <mikecampo>

posterous-python's People

Contributors

sir-pinecone avatar benjmin-r avatar

Watchers

James Cloos avatar wd5 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.