Last active
August 29, 2015 14:08
-
-
Save shichao-an/fa09286436d6f7118b97 to your computer and use it in GitHub Desktop.
Utility script for 115wangpan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 smarttab textwidth=78 | |
# | |
# Upload a torrent file and create a BitTorrent task | |
# Usage: python 115wangpan-up.py TORRENT_FILE | |
from __future__ import print_function | |
import sys | |
from u115 import API | |
def add_new_task(): | |
api = API() | |
api.login() | |
filename = sys.argv[1] | |
r = api.add_task_bt(filename) | |
print(r) | |
tasks = api.get_tasks() | |
print(tasks) | |
t1 = tasks[0] | |
print(t1, t1.status_human) | |
if __name__ == '__main__': | |
add_new_task() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment