insta-cs


Nameinsta-cs JSON
Version 1.0.4 PyPI version JSON
download
home_page
SummaryA client interface for the Instagram automation.
upload_time2023-01-12 16:04:00
maintainer
docs_urlNone
authorCharan
requires_python
licenseMIT
keywords insta_cs instagram
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Insta_cs API

A Python wrapper for the Instagram API with no 3rd party dependencies. Supports both the app and web APIs.

## Overview

I wrote this to access Instagram's API when they clamped down on developer access. Because this is meant to achieve [parity](COMPAT.md) with the [official public API](https://www.instagram.com/developer/endpoints/), methods not available in the public API will generally have lower priority.

## Features

- Supports many functions that are only available through the official app, such as:
    * Multiple feeds, such as [user feed], [location feed], [tag feed], [popular feed]
    * Post a [photo]or [video] to your feed or stories
    * [Like]/[unlike] posts
    * Get [post comments]
    * [Post]/[delete] comments
    * [Like]/[unlike] comments
    * [Follow]/[unfollow] users
    * User [stories]
    * And [more]
- The web api client supports a subset of functions that do not require login, such as:
    * Get user [info] and [feed]
    * Get [post comments]
    * And [more]
- Compatible with functions available through the public API using the ClientCompatPatch ([app]/[web]) utility class
- Beta Python 3 support

An [extension module](https://github.com/Charanpreet-Singh-AI/Insta_cs) is available to help with common tasks like pagination, posting photos or videos.

## Documentation

Documentation is available at https://github.com/Charanpreet-Singh-AI/Insta_cs

## Install

Install with pip:

``pip install insta_cs``

To update:

``pip install insta_cs --upgrade``

To update with latest repo code:

``pip install insta_cs --upgrade --force-reinstall``

Tested on Python 2.7 and 3.5.

## Usage

The [app API client](insta_cs/) emulates the official app and has a larger set of functions. The [web API client](insta_web_cs/) has a smaller set but can be used without logging in.

Your choice will depend on your use case.

The [``examples/``](examples/) and [``tests/``](tests/) are a good source of detailed sample code on how to use the clients, including a simple way to save the auth cookie for reuse.

### Option 1: Use the [official app's API](insta_cs/)

```python

from insta_cs import Client, ClientCompatPatch

user_name = 'YOUR_LOGIN_USER_NAME'
password = 'YOUR_PASSWORD'

api = Client(user_name, password)
results = api.feed_timeline()
items = [item for item in results.get('feed_items', [])
         if item.get('media_or_ad')]
for item in items:
    # Manually patch the entity to match the public api as closely as possible, optional
    # To automatically patch entities, initialise the Client with auto_patch=True
    ClientCompatPatch.media(item['media_or_ad'])
    print(item['media_or_ad']['code'])
```

### Option 2: Use the [official website's API](insta_web_cs/)

```python

from insta_web_cs import Client, ClientCompatPatch, ClientError, ClientLoginError

# Without any authentication
web_api = Client(auto_patch=True, drop_incompat_keys=False)
user_feed_info = web_api.user_feed('329452045', count=10)
for post in user_feed_info:
    print('%s from %s' % (post['link'], post['user']['username']))

# Some endpoints, e.g. user_following are available only after authentication
authed_web_api = Client(
    auto_patch=True, authenticate=True,
    username='YOUR_USERNAME', password='YOUR_PASSWORD')

following = authed_web_api.user_following('123456')
for user in following:
    print(user['username'])

# Note: You can and should cache the cookie even for non-authenticated sessions.
# This saves the overhead of a single http request when the Client is initialised.
```

### Avoiding Re-login

You are advised to persist/cache the auth cookie details to avoid logging in every time you make an api call. Excessive logins is a surefire way to get your account flagged for removal. It's also advisable to cache the client details such as user agent, etc together with the auth details.

The saved auth cookie can be reused for up to **90 days**.

## Donate

Want to keep this project going? Please donate generously [https://www.buymeacoffee.com/firstmodified](https://www.buymeacoffee.com/firstmodified)

[![Build](https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png)](https://www.buymeacoffee.com/firstmodified)

## Support

Make sure to review the [contributing documentation](CONTRIBUTING.md) before submitting an issue report or pull request.

## Legal

Disclaimer: This is not affliated, endorsed or certified by Instagram. This is an independent and unofficial API. Strictly **not for spam**. Use at your own risk.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "insta-cs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "insta_cs instagram",
    "author": "Charan",
    "author_email": "firstmodified@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b8/0e/a899d253cfd5e0f02bbd37f963b2235d7612092f572ee3560dc0273e00f6/insta_cs-1.0.4.tar.gz",
    "platform": "any",
    "description": "# Insta_cs API\r\n\r\nA Python wrapper for the Instagram API with no 3rd party dependencies. Supports both the app and web APIs.\r\n\r\n## Overview\r\n\r\nI wrote this to access Instagram's API when they clamped down on developer access. Because this is meant to achieve [parity](COMPAT.md) with the [official public API](https://www.instagram.com/developer/endpoints/), methods not available in the public API will generally have lower priority.\r\n\r\n## Features\r\n\r\n- Supports many functions that are only available through the official app, such as:\r\n    * Multiple feeds, such as [user feed], [location feed], [tag feed], [popular feed]\r\n    * Post a [photo]or [video] to your feed or stories\r\n    * [Like]/[unlike] posts\r\n    * Get [post comments]\r\n    * [Post]/[delete] comments\r\n    * [Like]/[unlike] comments\r\n    * [Follow]/[unfollow] users\r\n    * User [stories]\r\n    * And [more]\r\n- The web api client supports a subset of functions that do not require login, such as:\r\n    * Get user [info] and [feed]\r\n    * Get [post comments]\r\n    * And [more]\r\n- Compatible with functions available through the public API using the ClientCompatPatch ([app]/[web]) utility class\r\n- Beta Python 3 support\r\n\r\nAn [extension module](https://github.com/Charanpreet-Singh-AI/Insta_cs) is available to help with common tasks like pagination, posting photos or videos.\r\n\r\n## Documentation\r\n\r\nDocumentation is available at https://github.com/Charanpreet-Singh-AI/Insta_cs\r\n\r\n## Install\r\n\r\nInstall with pip:\r\n\r\n``pip install insta_cs``\r\n\r\nTo update:\r\n\r\n``pip install insta_cs --upgrade``\r\n\r\nTo update with latest repo code:\r\n\r\n``pip install insta_cs --upgrade --force-reinstall``\r\n\r\nTested on Python 2.7 and 3.5.\r\n\r\n## Usage\r\n\r\nThe [app API client](insta_cs/) emulates the official app and has a larger set of functions. The [web API client](insta_web_cs/) has a smaller set but can be used without logging in.\r\n\r\nYour choice will depend on your use case.\r\n\r\nThe [``examples/``](examples/) and [``tests/``](tests/) are a good source of detailed sample code on how to use the clients, including a simple way to save the auth cookie for reuse.\r\n\r\n### Option 1: Use the [official app's API](insta_cs/)\r\n\r\n```python\r\n\r\nfrom insta_cs import Client, ClientCompatPatch\r\n\r\nuser_name = 'YOUR_LOGIN_USER_NAME'\r\npassword = 'YOUR_PASSWORD'\r\n\r\napi = Client(user_name, password)\r\nresults = api.feed_timeline()\r\nitems = [item for item in results.get('feed_items', [])\r\n         if item.get('media_or_ad')]\r\nfor item in items:\r\n    # Manually patch the entity to match the public api as closely as possible, optional\r\n    # To automatically patch entities, initialise the Client with auto_patch=True\r\n    ClientCompatPatch.media(item['media_or_ad'])\r\n    print(item['media_or_ad']['code'])\r\n```\r\n\r\n### Option 2: Use the [official website's API](insta_web_cs/)\r\n\r\n```python\r\n\r\nfrom insta_web_cs import Client, ClientCompatPatch, ClientError, ClientLoginError\r\n\r\n# Without any authentication\r\nweb_api = Client(auto_patch=True, drop_incompat_keys=False)\r\nuser_feed_info = web_api.user_feed('329452045', count=10)\r\nfor post in user_feed_info:\r\n    print('%s from %s' % (post['link'], post['user']['username']))\r\n\r\n# Some endpoints, e.g. user_following are available only after authentication\r\nauthed_web_api = Client(\r\n    auto_patch=True, authenticate=True,\r\n    username='YOUR_USERNAME', password='YOUR_PASSWORD')\r\n\r\nfollowing = authed_web_api.user_following('123456')\r\nfor user in following:\r\n    print(user['username'])\r\n\r\n# Note: You can and should cache the cookie even for non-authenticated sessions.\r\n# This saves the overhead of a single http request when the Client is initialised.\r\n```\r\n\r\n### Avoiding Re-login\r\n\r\nYou are advised to persist/cache the auth cookie details to avoid logging in every time you make an api call. Excessive logins is a surefire way to get your account flagged for removal. It's also advisable to cache the client details such as user agent, etc together with the auth details.\r\n\r\nThe saved auth cookie can be reused for up to **90 days**.\r\n\r\n## Donate\r\n\r\nWant to keep this project going? Please donate generously [https://www.buymeacoffee.com/firstmodified](https://www.buymeacoffee.com/firstmodified)\r\n\r\n[![Build](https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png)](https://www.buymeacoffee.com/firstmodified)\r\n\r\n## Support\r\n\r\nMake sure to review the [contributing documentation](CONTRIBUTING.md) before submitting an issue report or pull request.\r\n\r\n## Legal\r\n\r\nDisclaimer: This is not affliated, endorsed or certified by Instagram. This is an independent and unofficial API. Strictly **not for spam**. Use at your own risk.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A client interface for the Instagram automation.",
    "version": "1.0.4",
    "split_keywords": [
        "insta_cs",
        "instagram"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "288d0bdef944d52907528440ee4a7c9199bba039e81bce5aca57d285630bce50",
                "md5": "7f8f9dd453d89856f046e18a6e80e09c",
                "sha256": "ffc2406d8966b4a03c98dfc7b6a004ac6db7eeae96df11c3ed5e5d4507208d71"
            },
            "downloads": -1,
            "filename": "insta_cs-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f8f9dd453d89856f046e18a6e80e09c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 77968,
            "upload_time": "2023-01-12T16:03:58",
            "upload_time_iso_8601": "2023-01-12T16:03:58.113697Z",
            "url": "https://files.pythonhosted.org/packages/28/8d/0bdef944d52907528440ee4a7c9199bba039e81bce5aca57d285630bce50/insta_cs-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b80ea899d253cfd5e0f02bbd37f963b2235d7612092f572ee3560dc0273e00f6",
                "md5": "588757a7a3490322a2c2bf762997e7e1",
                "sha256": "9694cb0380c74f937379447e55cf726a0a41471ef5e8211df40448f6effd0003"
            },
            "downloads": -1,
            "filename": "insta_cs-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "588757a7a3490322a2c2bf762997e7e1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 68301,
            "upload_time": "2023-01-12T16:04:00",
            "upload_time_iso_8601": "2023-01-12T16:04:00.259365Z",
            "url": "https://files.pythonhosted.org/packages/b8/0e/a899d253cfd5e0f02bbd37f963b2235d7612092f572ee3560dc0273e00f6/insta_cs-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-12 16:04:00",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "insta-cs"
}
        
Elapsed time: 0.04634s