Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shichao-an/fa09286436d6f7118b97 to your computer and use it in GitHub Desktop.
Save shichao-an/fa09286436d6f7118b97 to your computer and use it in GitHub Desktop.
Utility script for 115wangpan
#!/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