I believe he means using the Object Relational Model  ORM, which is an API 
abstraction for several frameworks.

Whether you use sql or the ORM (you can learn more about the ORM on the 
django project tutorial) only clouds the issue that you are trying to answer

SQL is SQL whether you make an abstraction layer or not

On Wednesday, March 28, 2012 7:07:22 PM UTC-4, coded kid wrote:
>
> Thanks guys!  @Pachnis How do you mean by Django API queries? 
>
> On Tuesday, 27 March 2012 08:59:28 UTC+1, coded kid wrote:
>>
>> Hi guys, I’m confused on how to make this work. I want to stream 
>> user’s tweets in my django app using tweepy. I’ve written the 
>> streaming code but the problem I’m facing is: should I paste the code 
>> in views.py and input- return 
>> render_to_response('tweet.html',context_instance=RequestContext(request)) 
>> after writing the code. Just like this: 
>>
>>
>> Q= sys.argv[1:] 
>>
>> db=MySQLdb.connect("localhost","","","Juzme") 
>>
>> auth=tweepy.OAuthHandler(consumer_key, consumer_secret) 
>> auth.set_access_token(access_token, access_token_secret) 
>>
>> cur=db.cursor() 
>>
>> class CustomStreamListener(tweepy.StreamListener): 
>>     def on_status(self, status): 
>>         try: 
>>             print "%s\t%s\t%s\t%s" % (status.text, 
>>                                       status.author.screen_name, 
>>                                       status.created_at, 
>>                                       status.source,) 
>>             cur.execute("INSERT INTO tweets VALUES (%s, %s, %s, %s)", 
>> (status.text, 
>>   
>> status.author.screen_name, 
>>   
>> status.created_at, 
>>   
>> status.source)) 
>>         except Exception, e: 
>>             print >> sys.stderr, 'Encountered Exception:', e 
>>             pass 
>>     def on_error(self, status_code): 
>>         print >> sys.stderr, 'Encountered error with status code:', 
>> status_code 
>>         return True 
>>     def on_timeout(self): 
>>         print >> sys.stderr, 'Timeout...' 
>>         return True 
>> streaming_api=tweepy.streaming.Stream(auth, CustomStreamListener(), 
>> timeout=60) 
>> print >> sys.stderr, 'Filtering the public timeline for "%s"' % (' 
>> '.join(sys.argv[1:]),) 
>> streaming_api.filter(follow=[], track=Q) 
>> return 
>> render_to_response('tweet.html',context_instance=RequestContext(request)) 
>>
>> If I can do it like this, won’t there be any code in template? Or 
>> what’s the best way I can carry out this operation. I hope you get my 
>> point? Thanks! 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/M4lYq8eObEQJ.
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