Meanwhile, and only If you want, send me or post here your nicknames of
twitter and I'll make a web2py twitter-list.
my twitter is @desmondo.


On Wed, Nov 3, 2010 at 10:06 PM, rochacbruno <rochacbr...@gmail.com> wrote:

> Do you mean showing who follows @web2py?
>
> I think it is a good idea, even to create some kind of web2pyers network
> based on twitter.
>
> Enviado via iPhone
>
> Em 03/11/2010, às 18:18, Michele Comitini <michele.comit...@gmail.com>
> escreveu:
>
> > Don't you think some components using this on web2py.com home page
> > would be nice?
> >
> >
> >
> > 2010/11/3 Bruno Rocha <rochacbr...@gmail.com>:
> >> Maybe it can be usefull for someone building a twitter app with web2py,
> >> I take this form an example posted by @gwidion on twitter.
> >> <code>
> >> # -*- coding: utf-8 -*-
> >> import urllib, json
> >> # Author: João S. O. Bueno
> >> # License: LGPL V 3.0
> >> def get_people_set(method, id, update=None):
> >>     url = "http://api.twitter.com/1/statuses/%s/%s.json";  % (method,
> id)
> >>     people = set()
> >>     cursor = "-1"
> >>     while True:
> >>         data = json.loads(urllib.urlopen(url + "?cursor=%s" %
> >> cursor).read())
> >>         cursor = data["next_cursor"]
> >>         if update:
> >>             update(cursor)
> >>         these_people = set(person["screen_name"] for person in
> >> data["users"])
> >>         people.update(these_people)
> >>         if not cursor  or not these_people :
> >>             break
> >>     return people
> >> </code>
> >> As it returns a set, it is easy to get its intersection/union and rest.
> >> <code>
> >> friends = get_people_set("friends", id, self.status)
> >> followers = get_people_set("followers", id, self.status)
> >> </code>
> >> To get who does not follow you, simple do:
> >> <code>
> >> noFollowers = sorted(friends - followers)
> >> </code>
> >> I am building my own twitter client, using @michelecomitini example,
> >> including some more options as this one.
> >>
> >> Bruno Rocha
> >> http://flavors.me/rochacbruno
> >>
> >>
> >>
> >>
>

Reply via email to