我正在使用Tweepy来访问流API.我可以使用下面的代码获得结果,但对于Geo Enabled值为"True"的推文,我得到的坐标返回值为"False".怎么会这样?我是否需要解码为status.coordinates返回的JSON对象?
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import random
import time
import MySQLdb
import json
consumer_key="XXX"
consumer_secret="XXX"
access_token="XXX"
access_token_secret="XXX"
db=MySQLdb.connect(host='localhost', user='XXX', passwd='XXX', db='twitter')
db.set_character_set('utf8')
Coords = dict()
Place = dict()
PlaceCoords = dict()
XY = []
curr=db.cursor()
class StdOutListener(StreamListener):
""" A listener handles tweets that are the received from the stream.
This is a basic listener that inserts tweets into MySQLdb.
"""
def on_status(self, status):
print "Tweet Text: ",status.text
text = status.text
print …Run Code Online (Sandbox Code Playgroud)