Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TweetsListener( StreamListener):
- def __init__(self,path):
- self.path = path
- def on_data(self, data):
- try:
- s3 = boto3.resource('s3')
- s3.put_object(Bucket='bucket',Body=data.encode('UTF-8'),Key='/A/'+self.path+'/test.json)
- return True
- except BaseException as e:
- print("Error on_data: %s" % str(e))
- return True
- def on_error(self, status):
- print(status)
- return True
Add Comment
Please, Sign In to add comment