Tag: python

HOWTO: Displaying Blogger feeds with Python

This first HOWTO is going to cover how I did the basic structure of the posts section of gPowered: pulling from blogger. The main functions we'll need are to show a range of posts, a single post, and a function to get the total number of posts that are in the blog. The reason I try to get the total number is so the different pages can be bookmarkable. When retrieving a GData feed from blogger. Entry 1 in the feed is going to be the newest post so there is no 'id' that is going to be static, so we'll do a…

Quick Docs Api Example (python)

To use the gdata docs python client you need to upgrade to 1.0.7 or higher. First thing is to import the modules you'll need. Then, set up the usual authentication parameters for the client. The most basic query will just return all of your documents However, if we want to display just the spreadsheets, we build the query like this: Finally, we output the titles If we wanted to, we could also import the DateTime library and show when the document was last updated For me this outputs:

HOWTO: Getting a list of post titles from blogger (Python)

This will be a quick one on how to pull the titles from your blog. I'm using it to Lists the posts I have available on gPowered.net. Firstly we'll set up our imports and call to the blogger service. For this query we're going to use the summary feed because all we really need for this is the titles, not the full posts: Then I just do a little counting so I can use the links on my site. All the information we need is in feed.entry

HOWTO: Pulling Google Bookmarks with Python

I love using Google Bookmarks (usually with the Google Toolbar) because it lets me get to my bookmarks at home on my laptop or desktop, at work, or anywhere. It's great. Now I'm using those bookmarks to power the links section of gPowered.net First we're going to need the httplib2 library so we can authenticate against Google and grab the bookmark feed and then the ElementTree to help process the rss feed. Then we'll setup the link to pull the rss from, authenticate against the request, and pull back the…

HOWTO: Google Reader API Functions

I've been wanting an API for Google reader since I started using it, and especially since i started gPowered so I could display a list of the feeds I read on the site. The official word on an API for reader is "It's coming in a few weeks," but that was back in late 2005. The reason being that at the time, the URLs the API would use were going to change a lot. So, after a bit of research and coding I came up with some python functions to do the job. The first step was authenticating against Google accounts…

HOWTO: Getting the Numer of Diggs from Digg (Python)

After 2 of my posts were on the Digg front page this morning (Thank you all very much to those that dugg them), I took my first look into the Digg API. I wanted a way to take a quick look to see how many Diggs certain stories were getting. In some ways it is similar to GData: make a call to a URL, get some XML back, parse it, etc. It does, however, feel lighter, probably due to its streamlined nature. It has one purpose, get information off of Digg. Using this, I've added a section in the Post List section…

Displaying what you read from Google Reader

I've been wanting to share what I subscribe to in Google Reader and using the functions I wrote I was able to do just that. Check out the article for the full run down on the unofficial Google Reader API. This is written in python but should be easily portable to php. If i get around to it, I want to make a WordPress plugin so bloggers can share what they read with their readers. This will be followed (or in parallel depending on my mood) with a Javascript version so Blogspot users can do the same in the…

Update Google Talk status with Twitter

I've had this idea in my head for a while and just got it to work this morning. Basically you send a tweet from Twitter and this script runs, picks up your current twitter status, and if need be, updates your gChat status. I'm working on a service version of this where you could use gpowered.net to do all this for you. Stay tuned =) If I change the version of the script that I have running in the service, you will be able to see the source code that I have checked in [here](http://code.google.com/p/gpo…

Django 1.0 released!

No, you’re not hallucinating, it’s really here. NOW GO GET IT

select foo, count(*) from bar group by foo in django

Every once in a while you need some old fashion SQL style queries in django. This is a common one for reporting and aggregation.  Its fairly easy to replicate in a queryset.  Say I wanted to get the authors and the number of articles they have written going back to the beginning of 2009 to the present: The result:

Some reading from django-nyc

Went to the django-nyc meetup last night, it was in Manhattan and much easier to get to then when it's at huge in bk.  Wrote down a few things to read up on: Celery - Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well. Django ideas - Voting on things with limited numbers of votes to spread around, ala UserVoice Google tech meetup Google prediction api Nyc js Ben Firshman class based views Django con blip…

Making virtualenv on windows with powershell a little cleaner

While I code on a mac at home, I can't live without my giant dual screens and solid state drive at work so I'm on a windows 7 box.  Most of the time it's fine, does everything I need, and I'm happy.  I became full of rage for the first time last week trying to properly get virtualenv to play nice with powershell.  (If you code on windows and are in the terminal a lot, switch to powershell, its great and comes with windows 7. There is a download for Windows XP) I'm not going to recap how to set up virtualenv…

Getting Started with Solr and Django

Solr is a very powerful search tool and it is pretty easy to get the basics, such as full text search, facets, and related assets up and running pretty quickly. We will be using haystack to do the communication between Django and Solr. All code for this can be viewed on github. Install Assuming you already have Django up and running, the first thing we need to do is install Solr. Next install pysolr and haystack. (At the time of this writing the git checkout of haystack works better with the Solr 4.0 beta…

Automate Adding to Trello on iOS with Launch Center Pro and Pythonista

I love using Trello to organize my life and work. While I kind of like it's iOS app, sometimes navigating to a board to add a card can be a little time consuming.  I want this process to be faster. I also use Launch Center Pro to get some quick actions that I miss from Android. Mostly around quick communication, adding events, and now, adding to Trello.  LCP uses x-callback-urls for inter-app communication, but Trello doesn't have any that I could see. Inspired by Federico Viticci's article on automating…