shichao-an / 115wangpan Goto Github PK
View Code? Open in Web Editor NEW(Deprecated) Unofficial Python API wrapper SDK for 115.com (115网盘)
Home Page: http://115wangpan.rtfd.org
License: BSD 2-Clause "Simplified" License
(Deprecated) Unofficial Python API wrapper SDK for 115.com (115网盘)
Home Page: http://115wangpan.rtfd.org
License: BSD 2-Clause "Simplified" License
1-5,8-9,11,12
Adding resume download features using pycurl.RESUME_FROM
f = files[0]
f.url
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/site-packages/u115/api.py", line 1240, in url
return self.get_download_url()
File "/usr/lib/python2.6/site-packages/u115/api.py", line 1234, in get_download_url
self.api._req_files_download_url(self.pickcode, proapi)
File "/usr/lib/python2.6/site-packages/u115/api.py", line 886, in _req_files_download_url
raise RequestFailure('Failed to get download URL.')
u115.api.RequestFailure: Failed to get download URL.
上传还能用吗?看到提示以弃用
show_progress
parameter is not logically implemented in utils.download
and utils.DownloadManager
Make download_file
to recursive download a BaseFile
object
File locate at
http://pan.baidu.com/s/1jGzO90a
This file come from this command.
➜ ~ rm /tmp/aa.cookie && curl 'http://passport.115.com/?ct=open_login&ac=api_login&t=qq&goto=&code=9AD253F2306CB0BC33D464C372928724' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8' -H 'Accept-Language: zh-CN,en-US;q=0.7,en;q=0.3' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Host: passport.115.com' -H 'Referer: http://openapi.qzone.qq.com/oauth/show?which=ConfirmPage&display=pc&redirect_uri=http%3A%2F%2Fpassport.115.com%2F%3Fct%3Dopen_login%26ac%3Dapi_login%26t%3Dqq%26goto%3D&response_type=code&oauth_token=&client_id=100229269' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0' -c /tmp/aa.cookie -b PHPSESSID=bo72eikeo6ijn9oibul0na5mn0 > /dev/null && cat /tmp/aa.cookie
I use these commands to load.
from u115 import API
api = API(auto_logout=False,persistent=True,cookies_filename='/tmp/aa.cookie',cookies_type='MozillaCookieJar')
api.cookies
str(api.cookies).count('=')
Only load three cookie name,It ignore the row which contain string "#HttpOnly_.115.com".
My python version
Python 3.4.3
Sorry for my english.
Such as edit
, add
, and move
methods
I 'm a VIP of 115. When I do add_task_bt()
continuously and there 're too many tasks(say 20 concurrent tasks), then I receive an error saying "超出最大任务数量"(exceeding the max allowed tasks amount), which is the expected behaviour.
So I sleep(30)
and try to add_task_bt()
again, expecting to either successfully add the task, or receive another same error. However, I then keeps getting "Torrent upload failed, Please try again later" error, and even after several minutes some of the tasks in the queue is finished(so there 's space for a new task), I keeps seeing this error.
Restarting my program and relogin()
, and I can add_task_bt()
smoothly.
I logined in with a VIP 115 account,and I get the download URL with this API ,but the download speed is too slow
用115浏览器下载,在多wan环境下有叠加效果,是否因为支持多线程下载的关系,搞不懂,望指教。
python是否也可以支持?
Use logging
library with multiple levels
In this way, it can call other lower level functions that return entries, e.g. API._req_files or API._req_search, with their own kwargs.
def _load_entries(count, page, func):
func will be a req function that return entry-like items
def _req_lixian_task_lists(self, page=1):
"""
This request will cause the system to create a default downloads
directory if it does not exist
"""
url = 'http://115.com/lixian/'
params = {'ct': 'lixian', 'ac': 'task_lists'}
self._load_signatures()
data = {
'page': page,
'uid': self.user_id,
'sign': self._signatures['offline_space'],
'time': self._lixian_timestamp,
}
req = Request(method='POST', url=url, params=params, data=data)
res = self.http.send(req)
你好, 请教一下, 每次我调用这里的时候, res都只会返回4个任务, 但是我在浏览器登陆115是有很多任务的,没有返回全部?
Rename auto_resume
optional argument name to resume
, which makes more sense;
Add auto_retry
optional argument which automatically retries on unfinished close transfer, typically indicated by errors like "pycurl.error: (18, 'transfer closed with 1949848720 bytes remaining to read')".
Add and check isatty()
to progress stream so when the program is not connected to the terminal, it will output like logs (one progress per line ending \n
instead of \r
).
def list(self, count=30, order='user_ptime', asc=False, show_dir=True,
natsort=True):
return self.directory.list(count, order, asc, show_dir, natsort)
提交离线任务后,如果该TASK是单一文件,没有目录的时候报错。好像是这个功能点还没实现吧?
Make the default behavior keep the directory structure; add a switch that enables flatten directories
Directory.search will call reimplemented Directory._load_entries() in #11
115登陆url和参数好像都改了, 导致登陆不上
Due to session constraints, download feature can be added where the current session is associated. iter_content
method of the Response
object from requests library can be used, and an ideal chunk_size
should be determined based on the file to be downloaded
谢谢你写的这个代码,今天用这个代码上传东西的时候报错,下面是我的代码:
import u115
api = u115.API()
api.login('usename', 'password')
u = api.upload('/root/sh/115/115_cookies.txt')
报下面的错误:
Traceback (most recent call last):
File "../115/115.py", line 10, in
u = api.upload('/root/sh/115/115_cookies.txt')
File "/usr/local/lib/python2.7/dist-packages/u115/api.py", line 306, in upload
directory = self.downloads_directory
File "/usr/local/lib/python2.7/dist-packages/u115/api.py", line 214, in downloads_directory
self._load_lixian_space()
File "/usr/local/lib/python2.7/dist-packages/u115/api.py", line 618, in _load_lixian_space
self._torrents_directory = self._load_directory(torrent_cid)
File "/usr/local/lib/python2.7/dist-packages/u115/api.py", line 608, in _load_directory
kwargs = self._req_directory(cid)
File "/usr/local/lib/python2.7/dist-packages/u115/api.py", line 511, in _req_directory
raise RequestFailure('No directory found.')
u115.api.RequestFailure: No directory found.
不知道怎么回事?还有请问在用api.upload 函数上传文件的时候,后面的directory 要怎么写,比如我要上传文件到movie文件夹,directory要怎么写?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.