1. bin zhang
  2. vyupoo

Source

vyupoo / demo.py

# -*- coding: utf-8 -*-
from yupoo import YupooAPI, operate_token_file, config

def main():
    yupoo = YupooAPI()
    token = operate_token_file()
    if token:
        print 'from file'
        yupoo.token = token
    else:
        print 'from new'
        frob = yupoo._auth()
        token = yupoo.get_token(frob)
        operate_token_file(token)
    filename='image.jpg'
    print yupoo.upload(filename, {'album_id': config.PICTURE_TEST})

if __name__ == '__main__':
    main()