def create_twitter_in_db(current_bar_id, twitter): tweets = [] for status in twitter: tweets.append(status.text) t = Twitter() t.google_id = current_bar_id t.screen_name = twitter[0].user.screen_name t.created_at = twitter[0].user.created_at try: t.location = twitter[0].user.location except: pass try: t.profile_image = twitter[0].user.profile_image_url_https except: pass try: t.profile_banner = twitter[0].user.profile_banner_url except: pass try: t.profile_link_color = twitter[0].user.profile_link_color except: pass try: t.website = twitter[0].user.entities['url']['urls'][0]['expanded_url'] except: pass t.updated_date = timezone.now() if tweets: t.statuses = tweets t.save()