python-500px

500PX API client


Keywords
500px
License
MIT
Install
pip install python-500px==0.3.0

Documentation

python-500px

Note:

The client doesn't work post June 15th 2018, due to 500px shutting down access to its API

A Python client for the 500px API.

this library was inspired by tweepy and python-instagram


Installation

pip install python-500px

Requires

  • simplejson

Usage

from fivehundredpx.client import FiveHundredPXAPI
from fivehundredpx.auth   import *

unauthorized_api = FiveHundredPXAPI(handler)
unauthorized_api.users_show(consumer_key=CONSUMER_KEY, id='727199')

handler = OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
handler.set_access_token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
api = FiveHundredPXAPI(handler)
api.users()

Authentication

Please check 500px's authentication document. tests/oauth.py shows how to get request/access token.

# verifier:
self.handler.get_authorization_url() # go to this url and get verifier
token = self.handler.get_access_token(verifier)
token.key, token.secret

# xauth:
token = self.handler.get_request_token()
self.handler.set_request_token(token.key, token.secret)
token = self.handler.get_xauth_access_token(username, password)
token.key, token.secret

Methods

  • api.photos()
  • api.photos_search()
  • api.photos_id()
  • api.photos_post()
  • api.photos_update()
  • api.photos_delete()
  • api.photos_comments()
  • api.photos_comments_post()
  • api.photos_favorites()
  • api.photos_favorite_post()
  • api.photos_favorite_delete()
  • api.photos_tags_post()
  • api.photos_tags_delete()
  • api.photos_votes()
  • api.photos_vote_post()
  • api.upload_photo()
  • api.users()
  • api.users_show()
  • api.users_search()
  • api.users_friends()
  • api.users_followers()
  • api.users_friends_post()
  • api.users_friends_delete()
  • api.blogs()
  • api.blogs_id()
  • api.blogs_comments()
  • api.comments_post()
  • api.collections()
  • api.collections_id()
  • api.collections_post()
  • api.collections_update()
  • api.collections_delete()

Test

python tests/oauth.py      [cunsumer_key] [consumer_secret]
python tests/blog.py       [cunsumer_key] [consumer_secret] [oauth_token] [oauth_token_secret]
python tests/collection.py [cunsumer_key] [consumer_secret] [oauth_token] [oauth_token_secret]
python tests/user.py       [cunsumer_key] [consumer_secret] [oauth_token] [oauth_token_secret]
python tests/photo.py      [cunsumer_key] [consumer_secret] [oauth_token] [oauth_token_secret]
python tests/upload.py     [cunsumer_key] [consumer_secret] [oauth_token] [oauth_token_secret]