# Path: endorsements/utils.py
# def get_twitter_client():
#     return twitter.Twitter(
#         auth=twitter.OAuth(
#             os.environ.get('ACCESS_TOKEN'),
#             os.environ.get('ACCESS_TOKEN_SECRET'),
#             os.environ.get('CONSUMER_KEY'),
#             os.environ.get('CONSUMER_SECRET'),
#         )
#     )


import shutil
import requests
        import boto
from django.db import models
from django.urls import reverse
from endorsements.utils import get_twitter_client
    def get_tags(self):
        return ' / '.join(tag.name for tag in self.tags.all())

    def get_current_endorsement(self):
        try:
            return self.endorsement_set.latest('quote')
        except Endorsement.DoesNotExist:
            pass

    def get_image(self):
        return '<img src="{url}" width="100" />'.format(
            url=self.get_image_url()
        )
    get_image.allow_tags = True

    def get_image_url(self):
        image_name = 'missing' if self.missing_image else self.pk
        return 'https://s3.amazonaws.com/endorsementdb.com/images/endorsers/%s.png' % image_name

    def needs_quotes(self):
        current_endorsement = self.get_current_endorsement()
        return not current_endorsement.quote.text
    needs_quotes.boolean = True

    def get_absolute_url(self):
        return reverse('view-endorser', args=[self.pk])


class AccountManager(models.Manager):
    def get_from_username(self, username, endorser=None):

# Path: endorsements/utils.py
# def get_twitter_client():
#     return twitter.Twitter(
#         auth=twitter.OAuth(
#             os.environ.get('ACCESS_TOKEN'),
#             os.environ.get('ACCESS_TOKEN_SECRET'),
#             os.environ.get('CONSUMER_KEY'),
#             os.environ.get('CONSUMER_SECRET'),
#         )
#     )


# Path: endorsements/models.py
import shutil
import requests
        import boto
from django.db import models
from django.urls import reverse
from endorsements.utils import get_twitter_client

    def get_tags(self):
        return ' / '.join(tag.name for tag in self.tags.all())

    def get_current_endorsement(self):
        try:
            return self.endorsement_set.latest('quote')
        except Endorsement.DoesNotExist:
            pass

    def get_image(self):
        return '<img src="{url}" width="100" />'.format(
            url=self.get_image_url()
        )
    get_image.allow_tags = True

    def get_image_url(self):
        image_name = 'missing' if self.missing_image else self.pk
        return 'https://s3.amazonaws.com/endorsementdb.com/images/endorsers/%s.png' % image_name

    def needs_quotes(self):
        current_endorsement = self.get_current_endorsement()
        return not current_endorsement.quote.text
    needs_quotes.boolean = True

    def get_absolute_url(self):
        return reverse('view-endorser', args=[self.pk])


class AccountManager(models.Manager):
    def get_from_username(self, username, endorser=None):

        twitter_client = get_twitter_client()