Instagram

class instagram.Instagram(client_id=None, access_token=None)

Create an Instagram service.

Variables:
  • client_id (str) – Associates your script with a specific application. Required if no access_token.
  • access_token (str) – For some requests, specifically those made on behalf of a user, authentication is needed. Required if no client_id.

AuthenticatedUser

Instagram.authenticated_user()

Return the resource corresponding to the authenticated user.

Feed

AuthenticatedUser.feed()

Return the resource corresponding to all entries for the user.

Feed.get(count=None, min_id=None, max_id=None)

Fetch all of the objects.

Variables:
  • count (int) – Count of media to return.
  • min_id (int) – Return media later than this min_id.
  • max_id (int) – Return media earlier than this max_id.

LikedMedia

AuthenticatedUser.liked_media()

Return the resource corresponding to all liked media for the user.

LikedMedia.get(count=None, max_liked_id=None)

Fetch all of the objects.

Variables:
  • count (int) – Count of media to return.
  • max_like_id (int) – Return media liked before this id.

RequestedBy

AuthenticatedUser.requested_by()

Return the resource corresponding to all requests for the user.

RequestedBy.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

AuthenticatedUser.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Geography

Instagram.geography(geo_id)

Return the resource corresponding to a single geography

RecentMedia

Geography.recent_media()

Return the resource corresponding to all recent media for the greography.

RecentMedia.get(count=None, max_timestamp=None, min_timestamp=None, min_id=None, max_id=None)

Fetch all of the objects.

Variables:
  • count (int) – Count of media to return.
  • max_timestamp (int) – Return media before this UNIX timestamp.
  • min_timestamp (int) – Return media after this UNIX timestamp.
  • min_id (int) – Return media later than this min_id.
  • max_id (int) – Return media earlier than this max_id.

Location

Instagram.location(location_id)

Return the resource corresponding to a single location.

RecentMedia

Location.recent_media()

Return the resource corresponding to all recent media for the location.

RecentMedia.get(count=None, max_timestamp=None, min_timestamp=None, min_id=None, max_id=None)

Fetch all of the objects.

Variables:
  • count (int) – Count of media to return.
  • max_timestamp (int) – Return media before this UNIX timestamp.
  • min_timestamp (int) – Return media after this UNIX timestamp.
  • min_id (int) – Return media later than this min_id.
  • max_id (int) – Return media earlier than this max_id.
Location.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Locations

Instagram.locations()

Return the resource corresponding to all locations.

Locations.get(lat=None, distance=None, lng=None, foursquare_v2_id=None, foursquare_id=None)

fetch all locations by geographic coordinate.

Variables:
  • lat (float) – Latitude of the center search coordinate. If used, lng is required.
  • distance (int) – Default is 1km (distance=1000), max distance is 5km.
  • lng (float) – Longitude of the center search coordinate. If used, lat is required.
  • foursquare_v2_id (str) – A foursquare v2 api location id. If used, you are not required to use lat and ln
  • foursquare_id (str) – A foursquare v1 api location id. If used, you are not required to use lat and lng. Note that this method is deprecated; you should use the new foursquare IDs with V2 of their API.

Media

Instagram.media(media_id)

Return the resource corresponding to a single media.

Comment

Media.comment(comment_id)

Return the resource corresponding to a single comment for the media.

Comment.delete()

Delete this resource.

Comments

Media.comments()

Return the resource corresponding to all comments for the media.

Comments.create(obj)

Create a new resource.

Variables:obj – a Python object representing the resource to be created, usually in the same format as returned from get. Refer to the upstream documentation for details.
Comments.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Likes

Media.likes()

Return the resource corresponding to all likes for the media.

Likes.create()

Set a like on this media by the currently authenticated user.

Likes.delete()

Remove a like on this media by the currently authenticated user.

Likes.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Media.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Medias

Instagram.medias()

Return the resource corresponding to all medias.

Medias.get(lat=None, max_timestamp=None, min_timestamp=None, lng=None, distance=None)

Fetch all of the objects.

Variables:
  • lat (float) – Latitude of the center search coordinate. If used, lng is required.
  • max_timestamp (int) – A unix timestamp. All media returned will be taken later than this timestamp.
  • min_timestamp (int) – A unix timestamp. All media returned will be taken earlier than this timestamp.
  • lng (float) – Longitude of the center search coordinate. If used, lat is required.
  • distance (int) – Default is 1km (distance=1000), max distance is 5km.

PopularMedia

Instagram.popular_media()

Return the resource corresponding to all most popular media.

PopularMedia.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Tag

Instagram.tag(tag_name)

Return the resource corresponding to a single tag.

RecentMedia

Tag.recent_media()

Return the resource corresponding to all recent media for the tag.

RecentMedia.get(count=None, max_timestamp=None, min_timestamp=None, min_id=None, max_id=None)

Fetch all of the objects.

Variables:
  • count (int) – Count of media to return.
  • max_timestamp (int) – Return media before this UNIX timestamp.
  • min_timestamp (int) – Return media after this UNIX timestamp.
  • min_id (int) – Return media later than this min_id.
  • max_id (int) – Return media earlier than this max_id.
Tag.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Tags

Instagram.tags()

Return the resource corresponding to all tags.

Tags.get(query)

fetch all tags by name.

Variables:query (str) – A valid tag name without a leading #. (eg. snow, nofilter).

User

Instagram.user(user_id)

Return the resource corresponding to a single user.

FollowedBy

User.followed_by()

Return the resource corresponding to all followers for the user.

FollowedBy.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Follows

User.follows()

Return the resource corresponding to all follows for the user.

Follows.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

RecentMedia

User.recent_media()

Return the resource corresponding to all recent media for the user.

RecentMedia.get(count=None, max_timestamp=None, min_timestamp=None, min_id=None, max_id=None)

Fetch all of the objects.

Variables:
  • count (int) – Count of media to return.
  • max_timestamp (int) – Return media before this UNIX timestamp.
  • min_timestamp (int) – Return media after this UNIX timestamp.
  • min_id (int) – Return media later than this min_id.
  • max_id (int) – Return media earlier than this max_id.

Relationship

User.relationship()

Return the resource corresponding to all relationships for the user.

Relationship.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Relationship.update(action)

Modifies the relationship between the current user and the target user.

Variables:action (str) – One of follow/unfollow/block/unblock/approve/deny.
User.get()

For single-object resources, fetch the object’s data. For collections, fetch all of the objects.

Users

Instagram.users()

Return the resource corresponding to all users.

Users.get(query, count=None)

Fetch all users by name.

Variables:
  • query (str) – A query string.
  • count (int) – Number of users to return.