Skip to content

Commit 14005ef

Browse files
authored
Merge pull request #17 from wkoot/coverage-integration
Coverage integration
2 parents 4e1e622 + a8549a6 commit 14005ef

File tree

6 files changed

+59
-320
lines changed

6 files changed

+59
-320
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ test_settings.py
55
dist
66
build
77
*.egg-info
8+
.coverage
9+
coverage.xml

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ python:
1111
- "nightly"
1212
install:
1313
- "pip install ."
14-
script: "python tests.py"
14+
- "pip install -r build_requirements.txt"
15+
script:
16+
- "coverage run tests.py"
17+
- "coverage xml -o coverage.xml"
18+
- "if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then
19+
python-codacy-coverage -r coverage.xml;
20+
fi"

README.md

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,49 @@
55
- - -
66

77
[![Build Status](https://api.travis-ci.org/wkoot/python-instagram.svg)](https://travis-ci.org/wkoot/python-instagram)
8+
[![Code Coverage](https://api.codacy.com/project/badge/coverage/6dd0431b8752421d95521ea59fc6ecc1)](https://www.codacy.com/app/wkoot/python-instagram)
9+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/6dd0431b8752421d95521ea59fc6ecc1)](https://www.codacy.com/app/wkoot/python-instagram)
10+
811

912
python-instagram
10-
======
13+
================
1114
A Python 2/3 client for the Instagram REST and Search APIs
1215

16+
1317
Installation
14-
-----
18+
------------
1519
```
16-
pip install python-instagram
20+
pip install instagram
1721
```
18-
Requires
19-
-----
22+
23+
24+
Requirements
25+
------------
2026
* httplib2
2127
* simplejson
2228
* six
29+
* pytz
2330

2431

2532
Instagram REST and Search APIs
2633
------------------------------
27-
Our [developer site](http://instagram.com/developer) documents all the Instagram REST and Search APIs.
34+
The [Instagram developer page](http://instagram.com/developer) supposedly documents all the Instagram REST and Search APIs.
2835

2936

30-
Blog
31-
----------------------------
32-
The [Developer Blog](http://developers.instagram.com/) features news and important announcements about the Instagram Platform. You will also find tutorials and best practices to help you build great platform integrations. Make sure to subscribe to the RSS feed not to miss out on new posts: [http://developers.instagram.com](http://developers.instagram.com).
37+
Instagram for developers blog
38+
-----------------------------
39+
The [Instagram for developers blog](http://developers.instagram.com/) features news and important announcements about the Instagram Platform.
40+
You will also find tutorials and best practices to help you build great platform integrations.
3341

3442

35-
Community
36-
----------------------
37-
The [Stack Overflow community](http://stackoverflow.com/questions/tagged/instagram/) is a great place to ask API related questions or if you need help with your code. Make sure to tag your questions with the Instagram tag to get fast answers from other fellow developers and members of the Instagram team.
43+
Stack Overflow community
44+
------------------------
45+
The Stack Overflow [instagram tag](http://stackoverflow.com/questions/tagged/instagram/) is a great place to ask API related questions or if you need help with your code.
46+
Make sure to tag your questions with the Instagram tag to get fast answers from other fellow developers and members of the Instagram team.
3847

3948

4049
Authentication
41-
-----
50+
--------------
4251

4352
Instagram API uses the OAuth2 protocol for authentication, but not all functionality requires authentication.
4453
See the docs for more information: http://instagram.com/developer/authentication/
@@ -66,7 +75,7 @@ recent_media, next_ = api.user_recent_media(user_id="userid", count=10)
6675
for media in recent_media:
6776
print media.caption.text
6877
```
69-
78+
7079
### Making unauthenticated requests
7180

7281
For methods that don't require authentication, you can just pass your client ID and optionally client secret into the InstagramAPI
@@ -79,8 +88,9 @@ for media in popular_media:
7988
print media.images['standard_resolution'].url
8089
```
8190

82-
Real-time Subscriptions:
83-
-----
91+
92+
Real-time Subscriptions
93+
-----------------------
8494

8595
See the docs for more on real-time subscriptions: http://instagr.am/developer/realtime/
8696

@@ -107,7 +117,7 @@ Along with that, you would typically register subscription "reactors" for proces
107117
reactor = subscriptions.SubscriptionsReactor()
108118
reactor.register_callback(subscriptions.SubscriptionType.USER, process_user_update)
109119
```
110-
120+
111121
See the provided sample app for an example of making a subscription, reacting to it, an processing the updates.
112122

113123
You can also use the API to list and delete subscriptions:
@@ -116,10 +126,10 @@ You can also use the API to list and delete subscriptions:
116126
api.list_subscriptions()
117127
api.delete_subscriptions(id=342342)
118128
```
119-
120129

121-
Data Retrieval:
122-
-----
130+
131+
Data Retrieval
132+
--------------
123133

124134
See the endpoints docs for more on these methods: http://instagr.am/developer/endpoints/
125135

@@ -142,15 +152,15 @@ while next_:
142152
```
143153

144154
Users: http://instagr.am/developer/endpoints/users/
145-
155+
146156
``` python
147157
api.user(user_id)
148158
api.user_media_feed()*
149159
api.user_liked_media()*
150160
api.user_recent_media(user_id, count, max_id)*
151161
api.user_search(q, count, lat, lng, min_timestamp, max_timestamp)
152162
```
153-
163+
154164
Relationships: http://instagr.am/developer/endpoints/relationships/
155165

156166
``` python
@@ -173,47 +183,49 @@ api.media(media_id)
173183
api.media_popular(count, max_id)
174184
api.media_search(q, count, lat, lng, min_timestamp, max_timestamp)
175185
```
176-
186+
177187
Comments: http://instagr.am/developer/endpoints/comments/
178188

179189
``` python
180190
api.media_comments(media_id)
181191
api.create_media_comment(media_id, text)
182192
api.delete_comment(media_id, comment_id)
183193
```
184-
194+
185195
Likes: http://instagr.am/developer/endpoints/likes/
186196

187197
``` python
188198
api.media_likes(media_id)
189199
api.like_media(media_id)
190200
api.unlike_media(media_id)
191201
```
192-
202+
193203
Tags: http://instagr.am/developer/endpoints/tags/
194204

195205
``` python
196206
api.tag(tag_name)
197207
api.tag_recent_media(count, max_tag_id, tag_name)*
198208
api.tag_search(q, count)*
199209
```
200-
210+
201211
Locations: http://instagr.am/developer/endpoints/locations/
202212

203213
``` python
204214
api.location(location_id)
205215
api.location_recent_media(count, max_id, location_id)*
206216
api.location_search(q, count, lat, lng, foursquare_id, foursquare_v2_id)
207217
```
208-
218+
209219
Geographies: http://instagr.am/developer/endpoints/geographies/
210220

211221
``` python
212222
api.geography_recent_media(count, max_id, geography_id)*
213223
```
214224

225+
215226
Error handling
216-
------
227+
--------------
228+
217229
Importing the bind module allows handling of specific error status codes. An example is provided below:
218230
``` python
219231
from instagram.bind import InstagramAPIError
@@ -225,8 +237,10 @@ except InstagramAPIError as e:
225237
print "\nUser is set to private."
226238
```
227239

240+
228241
Setting Timeouts
229-
------
242+
----------------
243+
230244
By default there is no timeout for requests to the Instagram API. You can specify a timeout in one of two ways:
231245
``` python
232246
from instagram.client import InstagramAPI
@@ -243,26 +257,15 @@ import socket
243257
socket.setdefaulttimeout(30)
244258
```
245259

260+
246261
Trouble Shooting
247-
------
262+
----------------
248263

249264
If you get an error of a module not being defined during the Instagram import call, this might update a necessary package.
250265
```
251266
sudo pip install --upgrade six
252267
```
253268

254-
Sample app
255-
------
256-
This repository includes a one-file sample app that uses the bottle framework and demonstrates
257-
authentication, subscriptions, and update processing. To try it out:
258-
259-
* Download bottle if you don't already have it: pip install bottle
260-
* Download bottle-session if you don't already have it: pip install bottle-session
261-
* Download and run a redis instance on port 6379 if you don't already have it. Check http://redis.io for instructions.
262-
* Set your redirect URI to 'http://localhost:8515/oauth_callback' in your dev profile
263-
* Open up sample\_app.py, update it with your client\_id and secret, and set redirect URI to 'http://localhost:8515/oauth_callback'
264-
* Run the file; it will host a local server on port 8515.
265-
* Try visiting http://localhost:8515 in your browser
266269

267270
Contributing
268271
------------
@@ -307,8 +310,9 @@ Submitting a Pull Request
307310
8. Submit a pull request.
308311
9. If you haven't already, complete the Contributor License Agreement ("CLA").
309312

313+
310314
Contributor License Agreement ("CLA")
311-
_____________________________________
315+
-------------------------------------
312316
In order to accept your pull request, we need you to submit a CLA. You only need
313317
to do this once to work on any of Instagram's or Facebook's open source projects.
314318

build_requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
twine==1.8.1
2+
coverage==4.4.1
3+
codacy-coverage==1.3.3

requirements.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
bottle==0.12.7
21
httplib2==0.9
3-
redis==2.10.3
42
simplejson==3.6.3
5-
beaker==1.6.4
63
six==1.8.0
74
pytz==2015.4
8-
twine==1.8.1

0 commit comments

Comments
 (0)