Thanks for your reply. Indeed, there is a nice Twitter API and I've
already managed to connect to twitter and get some meaningful output.

Twitter does indeed have an ID for each entry, so that part should be
trivial. So I suppose I'll do something like this:
get latest entry id from database

for entry in twitter_entries:
if entry id == latest entry id stop
otherwise, add entry to list/dictionary

add entries from list, if any, to database to preserve chronological
order.

all done!

Hm, seems too easy. I really needed a nudge in the right direction as
although I understand parts of what I'm about to do, I wasn't very
clear about how to put the pieces together.

I might report later to get confirmation that I'm really doing this
the right way, and for reference for others who might not know where
to start.

Thanks again
Björn

On Sep 17, 11:47 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2007-09-17 at 09:41 +0000, bjornkri wrote:
>
> [...]
>
> > My initial guess would be to create a model for twitter entries, and
> > then run a cron job that checks twitter every now and then, adding
> > entries into the django database when they are found.
>
> Seems reasonable.
>
> > In theory, I understand this (or at least I think I do), but in
> > practice I'm completely lost. How do I make sure I'm not getting
> > duplicate entries?
>
> The usual answer to questions like this is another question: "what
> constitutes a duplicate entry?" Once you know how to determine that two
> messages are duplicates, you can work out what you need to check to
> ensure you aren't processing any duplicates. Do messages come with some
> kind of twitter-supplied unique id? Is the text of the message plus its
> timestamp all you've got? In the latter case, you could make those two
> fields unique_together, or you could compute a hash based on this unique
> information and use that as the primary key or some other unique field.
>
> > How often should I sync? How do I do that?
>
> That's not really Django related. Twitter might have something in their
> API docs about recommended or maxium allowable frequency. As to how, why
> isn't it as simple as making a network connection and using the standard
> Twitter developer's API, which is documented on the twitter site? If you
> don't yet know how to do network interaction like that, it's essentially
> the equivalent of retrieving a web page using Python's network libraries
> (although at the socket level, rather than using urllib2). So look for
> tutorials on, say, the socket library, or look at how urllib2 or urllib
> retrieves HTTP data for examples.
>
> Regards,
> Malcolm
>
> --
> Honk if you love peace and quiet.http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to