pystagram.graph_api.endpoints.media package

Submodules

pystagram.graph_api.endpoints.media.children module

class pystagram.graph_api.endpoints.media.children.Children(media: Media)

Bases: object

The Children node of the Instagram Graph API.

Parameters:

media (Media) – An instance of the Media class.

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

Get a list of Instagram Media objects on an Instagram album Media object.

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

  • 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 /{media-id}/children endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.media.collaborators module

class pystagram.graph_api.endpoints.media.collaborators.Collaborators(media: Media)

Bases: object

The Collaborators node of the Instagram Graph API.

Parameters:

media (Media) – An instance of the Media class.

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

Get a list of Instagram users as collaborators and their invitation status on an IG Media object.

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

  • 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 /{media-id}/collaborators endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.media.comments module

class pystagram.graph_api.endpoints.media.comments.Comments(media: Media)

Bases: object

The Comments node of the Instagram Graph API.

Parameters:

media (Media) – An instance of the Media class.

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

Create a comment on an Instagram media.

Parameters:
  • media_id (str) – The ID of the media to create a comment on.

  • message (str) – The message of the comment to create.

  • 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 /{media-id}/comments endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

delete(*args, **kwargs)

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

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

Get comments on an Instagram media.

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

  • 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 /{media-id}/comments endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

update(*args, **kwargs)

[Not Supported] Update a comment on an Instagram media. :raises InstagramApiNotSupportedError: Comment update is not supported by the Instagram Graph API.

pystagram.graph_api.endpoints.media.insights module

class pystagram.graph_api.endpoints.media.insights.Insights(media: Media)

Bases: object

The Insights node of the Instagram Graph API.

Parameters:

media (Media) – An instance of the Media class.

get(media_id: str, metrics: List[InsightMetrics] | None = None, breakdown: Breakdown | None = None, access_token: str | None = None)

Get insights data on an Instagram media.

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

  • metrics (Optional[List[InsightMetrics]], optional) – A list of pystagram.graph_api.components.metrics.insight_metrics.InsightMetrics to get from the media, defaults to None

  • breakdown (Optional[Breakdown], optional) – The breakdown of the insights data, 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 /{media-id}/insights endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

pystagram.graph_api.endpoints.media.media module

class pystagram.graph_api.endpoints.media.media.Media(graph_api: GraphInstagramBaseApi)

Bases: object

The Media node of the Instagram Graph API.

Parameters:

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

property children

The ``Children` node of the Instagram Graph API. See the pystagram.graph_api.endpoints.media.children.Children class for more information.

property collaborators

The Collaborators node of the Instagram Graph API. See the pystagram.graph_api.endpoints.media.collaborators.Collaborators class for more information.

property comments

The Comments node of the Instagram Graph API. See the pystagram.graph_api.endpoints.media.comments.Comments class for more information.

create(*args, **kwargs)

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

delete()

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

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

Get fields and edges on an Instagram media.

Parameters:
  • media_id (str) – The ID of the media to get fields and edges 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

  • 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 /{media-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.media.insights.Insights class for more information.

property product_tags

The ProductTags node of the Instagram Graph API. See the pystagram.graph_api.endpoints.media.product_tags.ProductTags class for more information.

update(media_id: str, comment_enabled: bool | None = True, access_token: str | None = None)

Update an Instagram media. Only the comment_enabled field can be updated.

Parameters:
  • media_id (str) – The ID of the media to update.

  • comment_enabled (Optional[bool], optional) – Whether comments are enabled on the media, defaults to True

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

pystagram.graph_api.endpoints.media.product_tags module

class pystagram.graph_api.endpoints.media.product_tags.ProductTags(media: Media)

Bases: object

The ProductTags node of the Instagram Graph API.

Parameters:

media (Media) – An instance of the Media class.

create(media_id: str, product_tags: List[ProductTag], access_token: str | None = None)

Create product tags on an existing Instagram Media.

Parameters:
  • media_id (str) – The ID of the media to create product tags on.

  • product_tags (List[ProductTag]) – A list of pystagram.graph_api.components.tag.product_tag.ProductTag objects to create on the media.

  • 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 /{media-id}/product_tags endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

delete(media_id: str, product_tags: List[ProductTag], access_token: str | None = None)

Delete product tags on an existing Instagram Media.

Parameters:
  • media_id (str) – The ID of the media to delete product tags from.

  • product_tags (List[ProductTag]) – A list of pystagram.graph_api.components.tag.product_tag.ProductTag objects to delete from the media.

  • 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 DELETE /{media-id}/product_tags endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

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

Get a collection of product tags on an Instagram Media.

Parameters:
  • media_id (str) – The ID of the media to get product tags from.

  • 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 /{media-id}/product_tags endpoint.

Return type:

pystagram.helpers.api_client.api_response.InstagramApiResponse

update(media_id: str, product_tags: List[ProductTag], access_token: str | None = None)

Alias for the create method.

Module contents