This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add python 3 support #80
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from bind import InstagramAPIError, InstagramClientError | ||
from client import InstagramAPI | ||
from .bind import InstagramAPIError, InstagramClientError | ||
from .client import InstagramAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from helper import timestamp_to_datetime | ||
from .helper import timestamp_to_datetime | ||
|
||
|
||
class ApiModel(object): | ||
|
@@ -8,11 +8,11 @@ def object_from_dictionary(cls, entry): | |
# make dict keys all strings | ||
if entry is None: | ||
return "" | ||
entry_str_dict = dict([(str(key), value) for key, value in entry.items()]) | ||
entry_str_dict = dict([(str(key), value) for key, value in list(entry.items())]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here. No need to turn entry.items to a list. |
||
return cls(**entry_str_dict) | ||
|
||
def __repr__(self): | ||
return unicode(self).encode('utf8') | ||
return str(self).encode('utf8') | ||
|
||
|
||
class Image(ApiModel): | ||
|
@@ -36,7 +36,7 @@ class Media(ApiModel): | |
|
||
def __init__(self, id=None, **kwargs): | ||
self.id = id | ||
for key, value in kwargs.iteritems(): | ||
for key, value in list(kwargs.items()): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment goes for all dict's being converted to lists in this PR. |
||
setattr(self, key, value) | ||
|
||
def get_standard_resolution_url(self): | ||
|
@@ -67,12 +67,12 @@ def object_from_dictionary(cls, entry): | |
new_media.user = User.object_from_dictionary(entry['user']) | ||
|
||
new_media.images = {} | ||
for version, version_info in entry['images'].iteritems(): | ||
for version, version_info in list(entry['images'].items()): | ||
new_media.images[version] = Image.object_from_dictionary(version_info) | ||
|
||
if new_media.type == 'video': | ||
new_media.videos = {} | ||
for version, version_info in entry['videos'].iteritems(): | ||
for version, version_info in list(entry['videos'].items()): | ||
new_media.videos[version] = Video.object_from_dictionary(version_info) | ||
|
||
if 'user_has_liked' in entry: | ||
|
@@ -113,14 +113,14 @@ class MediaShortcode(Media): | |
|
||
def __init__(self, shortcode=None, **kwargs): | ||
self.shortcode = shortcode | ||
for key, value in kwargs.iteritems(): | ||
for key, value in list(kwargs.items()): | ||
setattr(self, key, value) | ||
|
||
|
||
class Tag(ApiModel): | ||
def __init__(self, name, **kwargs): | ||
self.name = name | ||
for key, value in kwargs.iteritems(): | ||
for key, value in list(kwargs.items()): | ||
setattr(self, key, value) | ||
|
||
def __unicode__(self): | ||
|
@@ -129,7 +129,7 @@ def __unicode__(self): | |
|
||
class Comment(ApiModel): | ||
def __init__(self, *args, **kwargs): | ||
for key, value in kwargs.iteritems(): | ||
for key, value in list(kwargs.items()): | ||
setattr(self, key, value) | ||
|
||
@classmethod | ||
|
@@ -156,7 +156,7 @@ def __unicode__(self): | |
class Location(ApiModel): | ||
def __init__(self, id, *args, **kwargs): | ||
self.id = id | ||
for key, value in kwargs.iteritems(): | ||
for key, value in list(kwargs.items()): | ||
setattr(self, key, value) | ||
|
||
@classmethod | ||
|
@@ -178,7 +178,7 @@ class User(ApiModel): | |
|
||
def __init__(self, id, *args, **kwargs): | ||
self.id = id | ||
for key, value in kwargs.iteritems(): | ||
for key, value in list(kwargs.items()): | ||
setattr(self, key, value) | ||
|
||
def __unicode__(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this still functions correctly, there isn't a need to try and turn this into a list: