wkoot/python-instagram

View on GitHub

Showing 19 of 19 total issues

Function bind_method has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Open

def bind_method(**config):
class InstagramAPIMethod(object):
 
path = config['path']
method = config.get('method', 'GET')
Severity: Minor
Found in instagram/bind.py - About 1 day to fix

InstagramAPITests has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

class InstagramAPITests(unittest.TestCase):
def setUp(self):
super(InstagramAPITests, self).setUp()
self.client_only_api = TestInstagramAPI(client_id=client_id)
self.api = TestInstagramAPI(access_token=access_token)
Severity: Minor
Found in tests.py - About 3 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class User(ApiModel):
    def __init__(self, id, *args, **kwargs):
    self.id = id
    for key, value in six.iteritems(kwargs):
    setattr(self, key, value)
    Severity: Major
    Found in instagram/models.py and 1 other location - About 2 hrs to fix
    instagram/models.py on lines 126..133

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class Tag(ApiModel):
    def __init__(self, name, **kwargs):
    self.name = name
    for key, value in six.iteritems(kwargs):
    setattr(self, key, value)
    Severity: Major
    Found in instagram/models.py and 1 other location - About 2 hrs to fix
    instagram/models.py on lines 181..188

    Function object_from_dictionary has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def object_from_dictionary(cls, entry):
    new_media = Media(id=entry['id'])
    new_media.type = entry['type']
    new_media.user = User.object_from_dictionary(entry['user'])
     
     
    Severity: Minor
    Found in instagram/models.py - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def get_low_resolution_url(self):
    if self.type == 'image':
    return self.images['low_resolution'].url
    else:
    return self.videos['low_resolution'].url
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 49..53

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def get_standard_resolution_url(self):
    if self.type == 'image':
    return self.images['standard_resolution'].url
    else:
    return self.videos['standard_resolution'].url
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 55..59

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if new_media.like_count:
    for like in entry.get('likes', {}).get('data', []):
    new_media.likes.append(User.object_from_dictionary(like))
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 92..94

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if new_media.comment_count:
    for comment in entry.get('comments', {}).get('data', []):
    new_media.comments.append(Comment.object_from_dictionary(comment))
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 86..88

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    for version, version_info in six.iteritems(entry.get('videos', {})):
    new_media.videos[version] = Video.object_from_dictionary(version_info)
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 74..75

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    for version, version_info in six.iteritems(entry.get('images', {})):
    new_media.images[version] = Image.object_from_dictionary(version_info)
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 79..80

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def __init__(self, id=None, **kwargs):
    self.id = id
    for key, value in six.iteritems(kwargs):
    setattr(self, key, value)
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 119..123

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class MediaShortcode(Media):
    def __init__(self, shortcode=None, **kwargs):
    self.shortcode = shortcode
    for key, value in six.iteritems(kwargs):
    setattr(self, key, value)
    Severity: Major
    Found in instagram/models.py and 1 other location - About 1 hr to fix
    instagram/models.py on lines 44..47

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def __init__(self, client_id=None, client_secret=None, client_ips=None, access_token=None, redirect_uri=None, timeout=None):
    Severity: Minor
    Found in instagram/oauth2.py - About 45 mins to fix

      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def __init__(self, status_code, error_type, error_message, *args, **kwargs):
      Severity: Minor
      Found in instagram/bind.py - About 35 mins to fix

        Function exchange_for_access_token has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def exchange_for_access_token(self, code=None, username=None, password=None, scope=None, user_id=None):
        Severity: Minor
        Found in instagram/oauth2.py - About 35 mins to fix

          Function _data_for_exchange has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _data_for_exchange(self, code=None, username=None, password=None, scope=None, user_id=None):
          Severity: Minor
          Found in instagram/oauth2.py - About 35 mins to fix

            Function _signed_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _signed_request(self, path, params, include_signed_request, include_secret):
            if include_signed_request and self.api.client_secret is not None:
            if self.api.access_token:
            params['access_token'] = self.api.access_token
            elif self.api.client_id:
            Severity: Minor
            Found in instagram/oauth2.py - About 35 mins to fix

            Function _data_for_exchange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _data_for_exchange(self, code=None, username=None, password=None, scope=None, user_id=None):
            client_params = {
            "client_id": self.api.client_id,
            "client_secret": self.api.client_secret,
            "redirect_uri": self.api.redirect_uri,
            Severity: Minor
            Found in instagram/oauth2.py - About 25 mins to fix
            Severity
            Category
            Status
            Source
            Language