Skip to content

Commit 31bca55

Browse files
authored
Merge branch 'master' into master
2 parents b2e4dd3 + a4d93b9 commit 31bca55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1582
-557
lines changed

.github/actions/install-dependencies/action.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ fi
1111
if [[ "${INSTALL_TEST_REQUIREMENTS}" == "true" ]]; then
1212
echo "Installing test requirements"
1313
pip install -r requirements-test.txt
14-
fi
14+
fi
15+
16+
if [[ "${INSTALL_DOCS_REQUIREMENTS}" == "true" ]]; then
17+
echo "Installing docs requirements"
18+
pip install -r requirements-docs.txt
19+
fi

.github/actions/install-dependencies/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: "Should requirements-test.txt be installed"
1010
default: "false"
1111
required: false
12+
docs-requirements:
13+
description: "Should requirements-docs.txt be installed"
14+
default: "false"
15+
required: false
1216
runs:
1317
using: "composite"
1418
steps:
@@ -17,4 +21,5 @@ runs:
1721
shell: "bash"
1822
env:
1923
INSTALL_REQUIREMENTS: ${{ inputs.requirements }}
20-
INSTALL_TEST_REQUIREMENTS: ${{ inputs.test-requirements }}
24+
INSTALL_TEST_REQUIREMENTS: ${{ inputs.test-requirements }}
25+
INSTALL_DOCS_REQUIREMENTS: ${{ inputs.docs-requirements }}

.github/actions/publish-docs-with-mike/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ runs:
3434
USER_EMAIL: ${{ inputs.email }}
3535
VERSION_NAME: ${{ inputs.version_name }}
3636
NEW_VERSION: ${{ inputs.new_version }}
37-
RELEASE_TAG: ${{ github.event.release.tag_name }}
37+
RELEASE_TAG: ${{ github.event.release.tag_name }}

.github/actions/publish-docs-with-mike/configure_git_user.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ fi
4242

4343
echo "::debug::Falling back to GITHUB_ACTOR"
4444
LOGIN="${GITHUB_ACTOR:-github_action}"
45-
set_and_exit "${LOGIN}" "${LOGIN}${NO_REPLY_SUFFIX}"
45+
set_and_exit "${LOGIN}" "${LOGIN}${NO_REPLY_SUFFIX}"

.github/actions/publish-docs-with-mike/update_docs_for_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ else
1212
mike retitle --message "Remove latest from title of ${PREV_LATEST}" "${PREV_LATEST}" "${PREV_LATEST}"
1313
fi
1414
echo "mike deploy --update-aliases --title \"${NEW_VERSION} (latest)\" \"${NEW_VERSION}\" \"latest\""
15-
mike deploy --update-aliases --title "${NEW_VERSION} (latest)" "${NEW_VERSION}" "latest"
15+
mike deploy --update-aliases --title "${NEW_VERSION} (latest)" "${NEW_VERSION}" "latest"

.github/workflows/python-package.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request: {}
1010

1111
env:
12-
PYTHON_VERSION: "3.9.14"
12+
PYTHON_VERSION: "3.13.5"
1313

1414
jobs:
1515
bandit:
@@ -68,7 +68,7 @@ jobs:
6868
runs-on: ubuntu-latest
6969
strategy:
7070
matrix:
71-
python-version: [ "3.10" ]
71+
python-version: [ "3.13.5" ]
7272
env:
7373
TEST_ACCOUNTS_URL: ${{ secrets.TEST_ACCOUNTS_URL }}
7474
steps:
@@ -113,6 +113,7 @@ jobs:
113113
with:
114114
requirements: "true"
115115
test-requirements: "true"
116+
docs-requirements: "true"
116117

117118
- name: Build Docs
118119
run: mkdocs build --strict
@@ -141,8 +142,9 @@ jobs:
141142
with:
142143
requirements: "true"
143144
test-requirements: "true"
145+
docs-requirements: "true"
144146

145-
- name: Push documentaiton changes
147+
- name: Push documentation changes
146148
uses: ./.github/actions/publish-docs-with-mike
147149
with:
148150
version_name: dev

README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
If you want to work with Instagrapi (business interests), we strongly advise you to prefer [HikerAPI](https://hikerapi.com/p/bkXQlaVe) project.
1+
If you want to work with Instagrapi (business interests), we strongly advise you to prefer [HikerAPI SaaS](https://hikerapi.com/p/bkXQlaVe) project.
22
However, you won't need to spend weeks or even months setting it up.
3-
The best service available today is [HikerAPI](https://hikerapi.com/p/bkXQlaVe), which handles 4–5 million daily requests, provides support around-the-clock, and offers partners a special rate.
4-
In many instances, our clients tried to save money and preferred instagrapi, but in our experience, they ultimately returned to [HikerAPI](https://hikerapi.com/p/bkXQlaVe) after spending much more time and money.
3+
The best service available today is [HikerAPI SaaS](https://hikerapi.com/p/bkXQlaVe), which handles 4–5 million daily requests, provides support around-the-clock, and offers partners a special rate.
4+
In many instances, our clients tried to save money and preferred instagrapi, but in our experience, they ultimately returned to [HikerAPI SaaS](https://hikerapi.com/p/bkXQlaVe) after spending much more time and money.
55
It will be difficult to find good accounts, good proxies, or resolve challenges, and IG will ban your accounts.
66

77
The instagrapi more suits for testing or research than a working business!
@@ -19,6 +19,7 @@ The instagrapi more suits for testing or research than a working business!
1919
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/instagrapi)
2020
![Checked with mypy](https://img.shields.io/badge/mypy-checked-blue)
2121

22+
> To run instagrapi you may need a [cheap and powerful server](https://powervps.net/?from=96837), I recommend using my promo you will support the author of this library!
2223
2324
Features:
2425

@@ -27,7 +28,7 @@ Features:
2728
* Getting public data of post, story, album, Reels, IGTV data and the ability to download content
2829
* Getting public data of hashtag and location data, as well as a list of posts for them
2930
* Getting public data of all comments on a post and a list of users who liked it
30-
* Management of [proxy servers](https://soax.com/?r=sEysufQI), mobile devices and challenge resolver
31+
* Management of [proxy servers](https://soax.com?afmc=sEysufQI), mobile devices and challenge resolver
3132
* Login by username and password, sessionid and support 2FA
3233
* Managing messages and threads for Direct and attach files
3334
* Download and upload a Photo, Video, IGTV, Reels, Albums and Stories
@@ -39,7 +40,7 @@ Features:
3940

4041
Fast and effective Instagram Private API wrapper (public+private requests and challenge resolver) without selenium. Use the most recent version of the API from Instagram, which was obtained using reverse-engineering with Charles Proxy and [Proxyman](https://proxyman.io/).
4142

42-
*Instagram API valid for **16 Dec 2023** (last reverse-engineering check)*
43+
*Instagram API valid for **25 May 2025** (last reverse-engineering check)*
4344

4445
Support **Python >= 3.9**
4546

@@ -83,6 +84,47 @@ user_id = cl.user_id_from_username(ACCOUNT_USERNAME)
8384
medias = cl.user_medias(user_id, 20)
8485
```
8586

87+
### Session with persistence
88+
89+
``` python
90+
from instagrapi import Client
91+
92+
cl = Client()
93+
cl.login(USERNAME, PASSWORD)
94+
cl.dump_settings("session.json")
95+
96+
# reload later without entering credentials again
97+
cl = Client()
98+
cl.load_settings("session.json")
99+
cl.login(USERNAME, PASSWORD)
100+
```
101+
102+
### Login using a sessionid
103+
104+
``` python
105+
from instagrapi import Client
106+
107+
cl = Client()
108+
cl.login_by_sessionid("<your_sessionid>")
109+
```
110+
111+
### List and download another user's posts
112+
113+
``` python
114+
from instagrapi import Client
115+
116+
cl = Client()
117+
cl.login(USERNAME, PASSWORD)
118+
119+
target_id = cl.user_id_from_username("target_user")
120+
posts = cl.user_medias(target_id, amount=10)
121+
for media in posts:
122+
# download photos to the current folder
123+
cl.photo_download(media.pk)
124+
125+
See [examples/session_login.py](examples/session_login.py) for a standalone script demonstrating these login methods.
126+
```
127+
86128
<details>
87129
<summary>Additional example</summary>
88130

docker/devbox.dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
FROM python:3.11.4-buster
1+
FROM python:3.13-bookworm
22

33
ARG _USER="instagrapi"
44
ARG _UID="1001"
55
ARG _GID="100"
66
ARG _SHELL="/bin/bash"
77

8-
98
RUN useradd -m -s "${_SHELL}" -N -u "${_UID}" "${_USER}"
109

1110
ENV USER ${_USER}
@@ -15,15 +14,13 @@ ENV HOME /home/${_USER}
1514
ENV PATH "${HOME}/.local/bin/:${PATH}"
1615
ENV PIP_NO_CACHE_DIR "true"
1716

18-
1917
RUN mkdir /app && chown ${UID}:${GID} /app
2018

2119
USER ${_USER}
2220

2321
COPY --chown=${UID}:${GID} ./requirements* /app/
24-
COPY --chown=${UID}:${GID} ./util /app/util/
2522
WORKDIR /app
2623

27-
RUN pip install -r requirements.txt -r requirements-test.txt
24+
RUN pip install -r requirements.txt -r requirements-test.txt -r requirements-docs.txt
2825

29-
CMD bash
26+
CMD bash

docker/lock_requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ pip install -r requirements.txt
55
printf "# THIS IS AN AUTOGENERATED LOCKFILE. DO NOT EDIT MANUALLY.\n" > requirements.lock
66
pip freeze --disable-pip-version-check --all >> requirements.lock
77

8-
echo "Rebuild containers to verify there are no conflicts."
8+
echo "Rebuild containers to verify there are no conflicts."

docker/run_tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ while [[ $# -gt 0 ]]; do
1818
case $arg in
1919
--format-code)
2020
BLACK_ACTION="--quiet"
21-
ISORT_ACTION="--recursive"
21+
ISORT_ACTION=""
2222
;;
2323
-h|--help)
2424
usage
@@ -36,8 +36,8 @@ done
3636

3737
python -m unittest tests.FakeClientTestCase tests.ClientPublicTestCase
3838

39-
echo "Running iSort..."
39+
echo "Running isort..."
4040
isort ${ISORT_ACTION} instagrapi
4141

4242
echo "Running flake8..."
43-
flake8 instagrapi --count --exit-zero --statistics
43+
flake8 instagrapi --count --exit-zero --statistics

0 commit comments

Comments
 (0)