对此非常新,但我需要来自伦敦地区的来自流媒体API服务的推特数据
这是我正在运行的代码
from tweepy import Stream
from tweepy.streaming import StreamListener
class MyListener(StreamListener):
def on_data(self, data):
try:
with open('london.json', 'a') as f:
f.write(data)
return True
except BaseException as e:
print("Error on_data: %s" % str(e))
return True
def on_error(self, status):
print(status)
return True
twitter_stream = Stream(auth, MyListener())
twitter_stream.filter(locations=['0.28,51.23,0.25,51.68'])
这是我不断得到的错误
TweepError: Wrong number of locations points, it has to be a multiple of 4
我可能会把边界框弄错,但我不确定如何在伦敦找到它?
谢谢