pystagram.graph_api.endpoints.user package

Submodules

pystagram.graph_api.endpoints.user.available_catalogs module

class pystagram.graph_api.endpoints.user.available_catalogs.AvailableCatalogs(user: User)

Bases: object

The AvailableCatalogs node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(user_id: str | None = None, fields: List[str | CatalogFields] | None = None, access_token: str | None = None)

Get the product catalog in an IG User’s Instagram Shop.

Parameters:
  • user_id (str, optional) – The ID of the user to get available catalogs from, inferred from the InstagramGraphApi instance if None, defaults to None

  • fields (Optional[List[Union[str, CatalogFields]]], optional) – A list of pystagram.graph_api.components.fields.catalog_fields.CatalogFields to get from the available catalogs, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/available_catalogs endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.business_discovery module

class pystagram.graph_api.endpoints.user.business_discovery.BusinessDiscovery(user: User)

Bases: object

The BusinessDiscovery node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(username: str, fields: List[str | UserFields] | None = None, user_id: str | None = None, access_token: str | None = None)

Get data about another Instagram Business or Creator Instagram User.

Parameters:
  • username (str) – The username of the Instagram Business or Creator Instagram User.

  • fields (Optional[List[Union[str, UserFields]]], optional) – A list of pystagram.graph_api.components.fields.user_fields.UserFields to get from the user, defaults to None

  • user_id (str, optional) – The ID of the user to get fields and edges from, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id} endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.content_publishing_limit module

class pystagram.graph_api.endpoints.user.content_publishing_limit.ContentPublishingLimit(user: User)

Bases: object

The ContentPublishingLimit node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(user_id: str | None = None, fields: List[str | PublishingLimitFields] | None = None, since: Timestamp | Strtotime | None = None, access_token: str | None = None)

Get the number of times an IG User has published and IG Container within a given time period.

Parameters:
  • user_id (str, optional) – The ID of the user to get the content publishing limit from, inferred from the User instance if None, defaults to None

  • fields (Optional[List[Union[str, PublishingLimitFields]]], optional) – A list of pystagram.graph_api.components.fields.publishing_limit_fields.PublishingLimitFields to get from the user, defaults to None

  • since (Optional[Union[Timestamp, Strtotime]], optional) – The start time to get the content publishing limit from, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the User instance if None, defaults to None

Returns:

The response from the GET /{user-id}/content_publishing_limit endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.insights module

class pystagram.graph_api.endpoints.user.insights.Insights(user: User)

Bases: object

The Insights node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(metric: List[InsightMetrics], period: Periods, since: Timestamp | Strtotime | None = None, until: Timestamp | Strtotime | None = None, user_id: str | None = None, access_token: str | None = None)

Get insights on an Instagram user

Parameters:
  • metric (List[InsightMetrics]) – A list of pystagram.graph_api.components.metrics.insight_metrics.InsightMetrics to get insights on.

  • period (Periods) – The period of time to get insights from.

  • since (Optional[Union[Timestamp, Strtotime]], optional) – The start time of the insights, defaults to None

  • until (Optional[Union[Timestamp, Strtotime]], optional) – The end time of the insights, defaults to None

  • user_id (str, optional) – The ID of the user to get insights from, inferred from the User instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/insights endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.live_media module

class pystagram.graph_api.endpoints.user.live_media.LiveMedia(user: User)

Bases: object

The LiveMedia node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(user_id: str | None = None, fields: List[str | MediaFields] | None = None, since: Timestamp | Strtotime | None = None, until: Timestamp | Strtotime | None = None, access_token: str | None = None)

Get a collection of live video IG Media on an IG User.

Parameters:
  • user_id (str, optional) – The ID of the user to get live videos from, inferred from the InstagramGraphApi instance if None, defaults to None

  • fields (Optional[List[Union[str, MediaFields]]], optional) – A list of pystagram.graph_api.components.fields.media_fields.MediaFields to get from the live videos, defaults to None

  • since (Optional[Union[Timestamp, Strtotime]], optional) – The Unix timestamp of the earliest live video to get, defaults to None

  • until (Optional[Union[Timestamp, Strtotime]], optional) – The Unix timestamp of the latest live video to get, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/live_videos endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.media module

class pystagram.graph_api.endpoints.user.media.Media(user: User)

Bases: object

The Media node of the Instagram Graph API.

Parameters:
  • user (User) – An instance of the User class.

  • max_pages (int, optional) – The maximum number of pages to get from paginated endpoints, defaults to 5

create(container: Type[BaseContainer], user_id: str | None = None, access_token: str | None = None)

Create an image, carousel, story or reel Instagram Container.

Parameters:
  • container (Type[BaseContainer]) – The container to create on the Instagram user. Can be an instance of the ImageContainer, VideoContainer, CarouselContainer, StoryContainer or ReelContainer classes.

  • user_id (str, optional) – The ID of the user to create the container on, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the POST /{user-id}/media endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

delete()

[Not Supported] Delete an Instagram Media. :raises InstagramApiNotSupportedError: Instagram user media deletion is not supported by the Instagram Graph API.

get(user_id: str | None = None, access_token: str | None = None, limit: int | None = 25, after: str | None = None, before: str | None = None)

Get a collection of IG Media on an IG User. Paginated endpoint.

Parameters:
  • user_id (str, optional) – The ID of the user to get media from, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

  • limit (int, optional) – The number of media to get per page, defaults to 25

  • after (str, optional) – The cursor to get the next page of media, defaults to None

  • before (str, optional) – The cursor to get the previous page of media, defaults to None

Returns:

The response from the GET /{user-id}/media endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

update(*args, **kwargs)

[Not Supported] Update an Instagram Media. :raises InstagramApiEndpointError: User media update is only supported by the Media node

pystagram.graph_api.endpoints.user.media_publish module

class pystagram.graph_api.endpoints.user.media_publish.MediaPublish(user: User)

Bases: object

The MediaPublish node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

create(container_id: str, user_id: str | None = None, access_token: str | None = None)

Publish an Instagram Media Container.

Parameters:
  • container_id (str) – The ID of the container to publish on the Instagram user.

  • user_id (str, optional) – The ID of the user to publish the container on, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the POST /{user-id}/media_publish endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.mentionned_comment module

class pystagram.graph_api.endpoints.user.mentionned_comment.MentionedComment(user: User)

Bases: object

The MentionedComment node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(comment_id: str, fields: List[str | CommentFields] | None = None, user_id: str | None = None, access_token: str | None = None)

Get data on an Instagram Comment in which an Instagram User has been @mentioned by another Instagram user. Paginated endpoint.

Parameters:
  • comment_id (str) – The ID of the comment to get data from.

  • fields (Optional[List[Union[str, CommentFields]]], optional) – A list of pystagram.graph_api.components.fields.comment_fields.CommentFields to get from the comment, defaults to None

  • user_id (str, optional) – The ID of the user to get the mentioned comment from, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/mentioned_comment endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.mentionned_media module

class pystagram.graph_api.endpoints.user.mentionned_media.MentionedMedia(user: User)

Bases: object

The MentionedMedia node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(media_id: int, fields: List[str | MediaFields] | None = None, user_id: str | None = None, access_token: str | None = None)

Get data on an Instagram Media in which an Instagram User has been @mentioned in a caption by another Instagram user. Paginated endpoint.

Parameters:
  • media_id (int) – The ID of the media to get data from.

  • fields (Optional[List[Union[str, MediaFields]]], optional) – A list of pystagram.graph_api.components.fields.media_fields.MediaFields to get from the media, defaults to None

  • user_id (str, optional) – The ID of the user to get the mentioned media from, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/mentioned_media endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.mentions module

class pystagram.graph_api.endpoints.user.mentions.Mentions(user: User)

Bases: object

The Mentions node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

create(media_id: str, message: str, comment_id: str | None = None, user_id: str | None = None, access_token: str | None = None)

Creates an Instagram Comment on an Instagram Media or Instagram comment in which an Instagram User has been @mentioned in.

Parameters:
  • media_id (str) – The ID of the media where the user was mentioned.

  • message (str) – The comment message.

  • user_id (str, optional) – The ID of the user to mention, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the POST /{user-id}/mentions endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.product_appeal module

class pystagram.graph_api.endpoints.user.product_appeal.ProductAppeal(user: User)

Bases: object

The ProductAppeal node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

create(appeal_reason: str, product_id: str, user_id: str | None = None, access_token: str | None = None)

Create an appeal for a rejected product.

Parameters:
  • appeal_reason (str) – The reason for the appeal.

  • product_id (str) – The ID of the product to appeal.

  • user_id (str, optional) – The ID of the user to appeal the product for, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the POST /{user-id}/product_appeal endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

get(product_id: str, user_id: str | None = None, access_token: str | None = None)

Get appeal status of a rejected product.

Parameters:
  • product_id (str) – The ID of the product to get appeal status from.

  • user_id (str, optional) – The ID of the user to get the appeal status from, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/product_appeal endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.recently_searched_hashtags module

class pystagram.graph_api.endpoints.user.recently_searched_hashtags.RecentlySearchedHashtags(user: User)

Bases: object

The RecentlySearchedHashtags node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(user_id: str | None = None, limit: int | None = None, access_token: str | None = None)

Get the hashtags that an Instagram User has queried using the Instagram Hashtags endpoint within the last 7 days.

Parameters:
  • user_id (str, optional) – The ID of the user to get the recently searched hashtags from, inferred from the InstagramGraphApi instance if None, defaults to None

  • limit (int, optional) – The number of hashtags to get per page, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/recently_searched_hashtags endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.stories module

class pystagram.graph_api.endpoints.user.stories.Stories(user: User)

Bases: object

The Stories node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

create(*args, **kwargs)

[Not Supported] Create a story Instagram Media. :raises InstagramApiEndpointError: User story creation is supported by the User Media node

delete(*args, **kwargs)

[Not Supported] Delete a story Instagram Media. :raises InstagramApiNotSupportedError: Instagram user story deletion is not supported by the Instagram Graph API.

get(user_id: str | None = None, access_token: str | None = None)

Get a collection of story Instagram Media objects on an Instagram User.

Parameters:
  • user_id (str, optional) – The ID of the user to get stories from, inferred from the InstagramGraphApi instance if None, defaults to None

  • access_token – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/stories endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

update(*args, **kwargs)

[Not Supported] Update a story Instagram Media. :raises InstagramApiNotSupportedError: Instagram user story update is not supported by the Instagram Graph API.

pystagram.graph_api.endpoints.user.tags module

class pystagram.graph_api.endpoints.user.tags.Tags(user: User)

Bases: object

The Tags node of the Instagram Graph API.

Parameters:

user (User) – An instance of the User class.

get(user_id: str | None = None, fields: List[str | MediaFields] | None = None, access_token: str | None = None)

Get a collection of Instagram Media objects in which an Instagram User has been tagged by another Instagram user.

Parameters:
  • user_id (str, optional) – The ID of the user to get tagged media from, inferred from the InstagramGraphApi instance if None, defaults to None

  • fields (Optional[List[Union[str, MediaFields]]], optional) – A list of pystagram.graph_api.components.fields.media_fields.MediaFields to get from the tagged media, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id}/tags endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.user.user module

class pystagram.graph_api.endpoints.user.user.User(graph_api: GraphInstagramBaseApi)

Bases: object

The User node of the Instagram Graph API.

Parameters:

graph_api (InstagramGraphApi) – An instance of the InstagramGraphApi class.

property available_catalogs

The AvailableCatalogs node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.available_catalogs.AvailableCatalogs class for additional details.

property business_discovery

The BusinessDiscovery node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.business_discovery.BusinessDiscovery class for additional details.

The CatalogProductSearch node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.catalog_product_search.CatalogProductSearch class for additional details.

property content_publishing_limit

The ContentPublishingLimit node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.content_publishing_limit.ContentPublishingLimit class for additional details.

get(user_id: str | None = None, fields: List[str | UserFields] | None = None, access_token: str | None = None)

Get fields and edges on an Instagram Business or Creator Account.

Parameters:
  • user_id (str, optional) – The ID of the user to get fields and edges from, inferred from the InstagramGraphApi instance if None, defaults to None

  • fields (Optional[List[Union[str, UserFields]]], optional) – A list of pystagram.graph_api.components.fields.user_fields.UserFields to get from the user, defaults to None

  • access_token (str, optional) – The access token of the Instagram user, inferred from the InstagramGraphApi instance if None, defaults to None

Returns:

The response from the GET /{user-id} endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

property insights

The Insights node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.insights.Insights class for additional details.

property live_media

The LiveMedia node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.live_media.LiveMedia class for additional details.

property media

The Media node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.media.Media class for additional details.

property media_publish

The MediaPublish node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.media_publish.MediaPublish class for additional details.

property mentioned_comment

The MentionedComment node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.mentionned_comment.MentionedComment class for additional details.

property mentioned_media

The MentionedMedia node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.mentionned_media.MentionedMedia class for additional details.

property mentions

The Mentions node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.mentions.Mentions class for additional details.

property product_appeal

The ProductAppeal node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.product_appeal.ProductAppeal class for additional details.

property recently_searched_hashtags

The RecentlySearchedHashtags node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.recently_searched_hashtags.RecentlySearchedHashtags class for additional details.

property stories

The Stories node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.stories.Stories class for additional details.

property tags

The Tags node of the Instagram Graph API. See the pystagram.graph_api.endpoints.user.tags.Tags class for additional details.

Module contents