Skip to content

Commit b6d0718

Browse files
authored
Merge pull request #71 from dsouzarc/master
Fixed issues with urllib import + added requirements.txt for easy install + updated README with installation instructions
2 parents 0dacc3b + 08f75ca commit b6d0718

File tree

3 files changed

+157
-3
lines changed

3 files changed

+157
-3
lines changed

InstagramAPI.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3+
34
import requests
45
import random
56
import json
@@ -10,6 +11,12 @@
1011
import time
1112
import copy
1213
import math
14+
import sys
15+
16+
#The urllib library was split into other modules from Python 2 to Python 3
17+
if sys.version_info.major == 3:
18+
import urllib.parse
19+
1320
from ImageUtils import getImageSize
1421
from requests_toolbelt import MultipartEncoder
1522
from moviepy.editor import VideoFileClip
@@ -558,7 +565,12 @@ def getLikedMedia(self,maxid=''):
558565
return self.SendRequest('feed/liked/?max_id='+str(maxid))
559566

560567
def generateSignature(self, data):
561-
return 'ig_sig_key_version=' + self.SIG_KEY_VERSION + '&signed_body=' + hmac.new(self.IG_SIG_KEY.encode('utf-8'), data.encode('utf-8'), hashlib.sha256).hexdigest() + '.' + urllib.parse.quote(data)
568+
try:
569+
parsedData = urllib.parse.quote(data)
570+
except AttributeError:
571+
parsedData = urllib.quote(data)
572+
573+
return 'ig_sig_key_version=' + self.SIG_KEY_VERSION + '&signed_body=' + hmac.new(self.IG_SIG_KEY.encode('utf-8'), data.encode('utf-8'), hashlib.sha256).hexdigest() + '.' + parsedData
562574

563575
def generateDeviceId(self, seed):
564576
volatile_seed = "12345"

README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,36 @@
55
<a href="https://github.com/LevPasha/Instagram-bot-cs" title="Instagram C# bot"><img src="https://img.shields.io/badge/C%23%20InstaBot-v1.0-blue.svg"></a>
66
<a href="https://github.com/LevPasha/instabot.py" title="python InstaBot"><img src="https://img.shields.io/badge/python%20InstaBot-v1.0.1-blue.svg"></a>
77

8-
Unofficial instagram API, give you access to ALL instagram features (like, follow, upload photo and video and etc)! Write on python.
8+
Unofficial Instagram API to give you access to ALL Instagram features (like, follow, upload photo and video, etc)! Written in Python.
99

10-
This is python port of https://github.com/mgp25/Instagram-API, written on PHP. Work in progress to copy all functional...
10+
This is the Python port of https://github.com/mgp25/Instagram-API which is written in PHP.
11+
It is still a work in progress to copy all of its API endpoints.
12+
13+
14+
### Installation Instructions
15+
16+
1. Fork/Clone/Download this repo
17+
18+
`git clone https://github.com/LevPasha/Instagram-API-python.git`
19+
20+
21+
2. Navigate to the directory
22+
23+
`cd Instagram-API-python`
24+
25+
26+
3. Install the dependencies
27+
28+
`https://github.com/LevPasha/Instagram-API-python.git`
29+
30+
31+
4. Modify test.py with your own username and password
32+
33+
34+
5. Run the test script
35+
36+
`python test.py`
37+
1138

1239
### Now InstagramAPI.py can:
1340

requirements.txt

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
argcomplete==1.1.0
2+
argh==0.26.1
3+
awscli==1.10.4
4+
awsebcli==3.7.3
5+
backports-abc==0.4
6+
backports.ssl-match-hostname==3.4.0.2
7+
BeautifulSoup==3.2.1
8+
beautifulsoup4==4.4.1
9+
blessed==1.9.5
10+
blinker==1.4
11+
botocore==1.3.30
12+
cached-property==1.3.0
13+
cement==2.4.0
14+
certifi==2015.11.20.1
15+
cffi==1.5.2
16+
chardet==2.3.0
17+
click==6.2
18+
colorama==0.3.3
19+
ConfigArgParse==0.10.0
20+
construct==2.5.2
21+
crypto==1.4.1
22+
cryptography==1.2.2
23+
cx-Freeze==4.3.4
24+
cycler==0.9.0
25+
Cython==0.23
26+
decorator==4.0.10
27+
docker-py==1.1.0
28+
dockerpty==0.3.4
29+
docopt==0.6.2
30+
docutils==0.12
31+
EbookLib==0.15
32+
enum34==1.1.1
33+
epub==0.5.2
34+
Epubzilla==0.1.1
35+
Flask==0.10.1
36+
Flask-SQLAlchemy==2.0
37+
funcsigs==1.0.2
38+
futures==3.0.5
39+
h2==2.1.2
40+
hpack==2.1.0
41+
html2text==2016.1.8
42+
httplib2==0.9.2
43+
hyperframe==3.2.0
44+
idna==2.0
45+
imageio==2.0.1
46+
ipaddress==1.0.15
47+
itsdangerous==0.24
48+
Jinja2==2.8
49+
jmespath==0.9.0
50+
Kivy==1.9.1
51+
Kivy-Garden==0.1.4
52+
lxml==3.5.0
53+
mandrill==1.0.57
54+
MarkupSafe==0.23
55+
matplotlib==1.5.1
56+
mitmproxy==0.16
57+
mock==2.0.0
58+
moviepy==0.2.2.11
59+
Naked==0.1.31
60+
netlib==0.16
61+
nose==1.3.7
62+
numpy==1.10.4
63+
oauth2==1.9.0.post1
64+
passlib==1.6.5
65+
pathspec==0.3.3
66+
pathtools==0.1.2
67+
pbr==1.10.0
68+
pdfminer==20140328
69+
Pillow==3.1.1
70+
pipreqs==0.4.2
71+
protobuf==3.0.0b2
72+
pyasn1==0.1.9
73+
pycparser==2.14
74+
pycrypto==2.6.1
75+
pymongo==3.3.1
76+
PyMySQL==0.6.6
77+
pyOpenSSL==0.15.1
78+
pyparsing==2.1.0
79+
pyperclip==1.5.24
80+
pysnap==0.1.1
81+
python-dateutil==2.5.0
82+
python-docx==0.8.5
83+
python-pptx==0.5.8
84+
pytz==2015.7
85+
PyYAML==3.11
86+
requesocks==0.10.8
87+
requests==2.9.1
88+
requests-toolbelt==0.7.0
89+
rsa==3.3
90+
s3transfer==0.0.1
91+
schedule==0.3.2
92+
shellescape==3.4.1
93+
singledispatch==3.4.0.3
94+
six==1.10.0
95+
slackclient==0.16
96+
slacker==0.8.6.2
97+
snapchat-bots==0.1
98+
SpeechRecognition==3.3.0
99+
SQLAlchemy==1.0.8
100+
tensorflow==0.10.0rc0
101+
textract==1.4.0
102+
texttable==0.8.4
103+
tornado==4.3
104+
tqdm==4.10.0
105+
uber-rides==0.1.1
106+
urwid==1.3.1
107+
virtualenv==14.0.6
108+
watchdog==0.8.3
109+
wcwidth==0.1.6
110+
websocket-client==0.35.0
111+
Werkzeug==0.10.4
112+
wheel==0.29.0
113+
xlrd==0.9.4
114+
XlsxWriter==0.8.4
115+
yarg==0.1.9

0 commit comments

Comments
 (0)