python-115


Namepython-115 JSON
Version 0.0.5.11 PyPI version JSON
download
home_pagehttps://github.com/ChenyangGao/web-mount-packs/tree/main/python-115-client
SummaryPython wrapper for 115 webdisk.
upload_time2024-04-12 09:41:48
maintainerNone
docs_urlNone
authorChenyangGao
requires_python<4.0,>=3.11
licenseMIT
keywords nas 115
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 115 网盘 Web API 的 Python 封装

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-115)
![PyPI - Version](https://img.shields.io/pypi/v/python-115)
![PyPI - Downloads](https://img.shields.io/pypi/dm/python-115)
![PyPI - Format](https://img.shields.io/pypi/format/python-115)
![PyPI - Status](https://img.shields.io/pypi/status/python-115)

## 安装

通过 [pypi](https://pypi.org/project/python-115/)

```console
pip install -U python-115
```

## 入门介绍

### 1. 导入模块和创建实例

**导入模块**

```python
from p115 import P115Client, P115FileSystem
```

**创建客户端对象,需要传入 <kbd>cookie</kbd>,如果不传或者 <kbd>cookie</kbd> 失效,则需要扫码登录**

```python
cookie = "UID=...;CID=...;SEID=..."
client = P115Client(cookie)
```

**创建文件系统对象**

```python
fs = P115FileSystem(client)
```

或者直接在 <kbd>client</kbd> 上就可获取文件系统对象

```python
fs = client.fs
```

### 2. 操作网盘使用 Python 式的文件系统方法

文件系统对象的方法,设计和行为参考了 <kbd>[os](https://docs.python.org/3/library/os.html)</kbd>、<kbd>[posixpath](https://docs.python.org/3/library/os.path.html)</kbd>、<kbd>[pathlib.Path](https://docs.python.org/3/library/pathlib.html)</kbd> 和 <kbd>[shutil](https://docs.python.org/3/library/shutil.html)</kbd> 等模块。

<kbd>p115.P115FileSystem</kbd> 实现了在自己的网盘上,读写的文件系统方法

<kbd>p115.P115Path</kbd> 实现了二次封装,从路径的角度来进行操作。

**使用** <kbd>getcwd</kbd> **方法,获取当前工作目录的路径,参考** <kbd>os.getcwd</kbd>

```python
>>> fs.getcwd()
'/'
```

**使用** <kbd>getcid</kbd> **方法,获取当前工作目录的 id**

```python
>>> fs.getcid()
0
```

**使用** <kbd>listdir</kbd> **方法,罗列当前目录的文件名,参考** <kbd>os.listdir</kbd>

```python
>>> fs.listdir()
['云下载',
 '000阅读·乱七八糟',
 '电视剧',
 '电影',
 '纪录片',
 'libgen',
 '👾0号:重要资源',
 '📚1号:书籍大礼包',
 '📼资料备份']
```

**使用** <kbd>listdir_attr</kbd> **方法,罗列当前目录时,还可以获取属性**

```python
>>> fs.listdir_attr()
[{'name': '云下载',
  'is_directory': True,
  'size': None,
  'id': 2593093001609739968,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 16, 21, 58, 22),
  'utime': datetime.datetime(2023, 12, 19, 11, 29, 29),
  'ptime': datetime.datetime(2023, 3, 18, 18, 52, 54),
  'open_time': datetime.datetime(2023, 12, 19, 11, 29, 29),
  'time': datetime.datetime(2023, 12, 16, 21, 58, 22),
  'pick_code': 'fe1kl2mz1if2fl3wmx',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/云下载'},
 {'name': '000阅读·乱七八糟',
  'is_directory': True,
  'size': None,
  'id': 2592968610464922758,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'utime': datetime.datetime(2023, 12, 14, 15, 38, 18),
  'ptime': datetime.datetime(2023, 3, 18, 14, 45, 45),
  'open_time': datetime.datetime(2023, 12, 14, 13, 17, 9),
  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'pick_code': 'fccgz8vtu9xt08rmt6',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/000阅读·乱七八糟'},
 {'name': '电视剧',
  'is_directory': True,
  'size': None,
  'id': 2614100250469596984,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'utime': datetime.datetime(2023, 12, 15, 0, 48, 36),
  'ptime': datetime.datetime(2023, 4, 16, 18, 30, 33),
  'open_time': datetime.datetime(2023, 12, 15, 0, 48, 36),
  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'pick_code': 'fdjemtliv9d5b55y6u',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/电视剧'},
 {'name': '电影',
  'is_directory': True,
  'size': None,
  'id': 2580587204111760961,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'utime': datetime.datetime(2023, 12, 14, 15, 0, 45),
  'ptime': datetime.datetime(2023, 3, 1, 12, 46, 7),
  'open_time': datetime.datetime(2023, 12, 12, 21, 56, 25),
  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'pick_code': 'fdj4gtgvtd5p8q5y6u',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/电影'},
 {'name': '纪录片',
  'is_directory': True,
  'size': None,
  'id': 2576930424647319247,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 18, 18, 49, 29),
  'utime': datetime.datetime(2023, 12, 18, 18, 49, 29),
  'ptime': datetime.datetime(2023, 2, 24, 11, 40, 45),
  'open_time': datetime.datetime(2023, 12, 13, 15, 45, 53),
  'time': datetime.datetime(2023, 12, 18, 18, 49, 29),
  'pick_code': 'fdjagt4u21x1k35y6u',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/纪录片'},
 {'name': 'libgen',
  'is_directory': True,
  'size': None,
  'id': 2644648816430546428,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'utime': datetime.datetime(2023, 12, 15, 18, 24, 57),
  'ptime': datetime.datetime(2023, 5, 28, 22, 5, 6),
  'open_time': datetime.datetime(2023, 12, 15, 18, 24, 57),
  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'pick_code': 'fcid29t51koofbrmt6',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/libgen'},
 {'name': '👾0号:重要资源',
  'is_directory': True,
  'size': None,
  'id': 2580131407544188592,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'utime': datetime.datetime(2023, 12, 19, 11, 29, 45),
  'ptime': datetime.datetime(2023, 2, 28, 21, 40, 32),
  'open_time': datetime.datetime(2023, 12, 19, 11, 29, 45),
  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'pick_code': 'fa8p74ih0nu1ax4fyr',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/👾0号:重要资源'},
 {'name': '📚1号:书籍大礼包',
  'is_directory': True,
  'size': None,
  'id': 2580246506904748007,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'utime': datetime.datetime(2023, 12, 19, 11, 29, 44),
  'ptime': datetime.datetime(2023, 3, 1, 1, 29, 12),
  'open_time': datetime.datetime(2023, 12, 19, 11, 29, 44),
  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'pick_code': 'fccqsmu7225f2vrmt6',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/📚1号:书籍大礼包'},
 {'name': '📼资料备份',
  'is_directory': True,
  'size': None,
  'id': 2673432528538303699,
  'parent_id': 0,
  'sha1': None,
  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'utime': datetime.datetime(2023, 12, 15, 0, 12, 1),
  'ptime': datetime.datetime(2023, 7, 7, 15, 13, 12),
  'open_time': datetime.datetime(2023, 12, 15, 0, 12, 1),
  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),
  'pick_code': 'fcilznsigu2hczrmt6',
  'star': False,
  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),
  'path': '/📼资料备份'}]
```

**使用** <kbd>listdir_path</kbd> **方法,罗列当前目录时,还可以获取** <kbd>p115.P115Path</kbd> **对象**

```python
[<p115.P115Path(name='云下载', is_directory=True, size=None, id=2593093001609739968, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 16, 21, 58, 22), utime=datetime.datetime(2023, 12, 19, 11, 29, 29), ptime=datetime.datetime(2023, 3, 18, 18, 52, 54), open_time=datetime.datetime(2023, 12, 19, 11, 29, 29), time=datetime.datetime(2023, 12, 16, 21, 58, 22), pick_code='fe1kl2mz1if2fl3wmx', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/云下载')>,
 <p115.P115Path(name='000阅读·乱七八糟', is_directory=True, size=None, id=2592968610464922758, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 38, 18), ptime=datetime.datetime(2023, 3, 18, 14, 45, 45), open_time=datetime.datetime(2023, 12, 14, 13, 17, 9), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccgz8vtu9xt08rmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/000阅读·乱七八糟')>,
 <p115.P115Path(name='电视剧', is_directory=True, size=None, id=2614100250469596984, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 48, 36), ptime=datetime.datetime(2023, 4, 16, 18, 30, 33), open_time=datetime.datetime(2023, 12, 15, 0, 48, 36), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdjemtliv9d5b55y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/电视剧')>,
 <p115.P115Path(name='电影', is_directory=True, size=None, id=2580587204111760961, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 0, 45), ptime=datetime.datetime(2023, 3, 1, 12, 46, 7), open_time=datetime.datetime(2023, 12, 12, 21, 56, 25), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdj4gtgvtd5p8q5y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/电影')>,
 <p115.P115Path(name='纪录片', is_directory=True, size=None, id=2576930424647319247, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 18, 18, 49, 29), utime=datetime.datetime(2023, 12, 18, 18, 49, 29), ptime=datetime.datetime(2023, 2, 24, 11, 40, 45), open_time=datetime.datetime(2023, 12, 13, 15, 45, 53), time=datetime.datetime(2023, 12, 18, 18, 49, 29), pick_code='fdjagt4u21x1k35y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/纪录片')>,
 <p115.P115Path(name='libgen', is_directory=True, size=None, id=2644648816430546428, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 18, 24, 57), ptime=datetime.datetime(2023, 5, 28, 22, 5, 6), open_time=datetime.datetime(2023, 12, 15, 18, 24, 57), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcid29t51koofbrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/libgen')>,
 <p115.P115Path(name='👾0号:重要资源', is_directory=True, size=None, id=2580131407544188592, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 45), ptime=datetime.datetime(2023, 2, 28, 21, 40, 32), open_time=datetime.datetime(2023, 12, 19, 11, 29, 45), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fa8p74ih0nu1ax4fyr', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/👾0号:重要资源')>,
 <p115.P115Path(name='📚1号:书籍大礼包', is_directory=True, size=None, id=2580246506904748007, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 44), ptime=datetime.datetime(2023, 3, 1, 1, 29, 12), open_time=datetime.datetime(2023, 12, 19, 11, 29, 44), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccqsmu7225f2vrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/📚1号:书籍大礼包')>,
 <p115.P115Path(name='📼资料备份', is_directory=True, size=None, id=2673432528538303699, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 12, 1), ptime=datetime.datetime(2023, 7, 7, 15, 13, 12), open_time=datetime.datetime(2023, 12, 15, 0, 12, 1), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcilznsigu2hczrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/📼资料备份')>]
```

**使用** <kbd>chdir</kbd> **方法,进入某个目录,就像** <kbd>os.chdir</kbd>

```python
>>> fs.chdir("电视剧/欧美剧/A")
2598195078816071040
>>> fs.getcwd()
'/电视剧/欧美剧/A'
>>> fs.getcid()
2598195078816071040
>>> fs.listdir()
['A《爱、死亡和机器人》(Love.Death.and.Robot)[tt9561862]']
>>> fs.chdir("A《爱、死亡和机器人》(Love.Death.and.Robot)[tt9561862]/爱、死亡和机器人S01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG(18集)")
2576931481024724685
>>> fs.listdir()
['Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.简体&英文.ass', 'Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv']
```

**使用** <kbd>attr</kbd> **方法,获取文件或文件夹的属性** 

```python
>>> fs.attr("Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv")
{'name': 'Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv',
 'is_directory': False,
 'size': 924544482,
 'id': 2576931481393823441,
 'parent_id': 2576931481024724685,
 'sha1': '7F4121B68A4E467ABF30A84627E20A8978895A4E',
 'etime': datetime.datetime(2023, 2, 24, 11, 42, 51),
 'utime': datetime.datetime(2023, 12, 19, 0, 21, 42),
 'ptime': datetime.datetime(2023, 2, 24, 11, 42, 51),
 'open_time': datetime.datetime(2023, 7, 7, 0, 50, 30),
 'pick_code': 'djagtomczh64gx50u',
 'star': False,
 'play_long': 1034,
 'lastest_update': datetime.datetime(2023, 12, 19, 11, 41, 34, 914934),
 'path': '/电视剧/欧美剧/A/A《爱、死亡和机器人》(Love.Death.and.Robot)[tt9561862]/爱、死亡和机器人S01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG(18集)/Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv'}
```

**使用** <kbd>stat</kbd> **方法,获取文件或文件夹的部分,参考** <kbd>os.stat</kbd>

```python
>>> fs.stat("Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv")
os.stat_result(st_mode=33279, st_ino=2576931481393823441, st_dev=2576931481024724685, st_nlink=1, st_uid=306576686, st_gid=1, st_size=924544482, st_atime=1688662230.0, st_mtime=1677210171.0, st_ctime=1677210171.0)
```

**使用** <kbd>open</kbd> **方法,打开一个文件(目前只支持读取,不支持写入),参考** <kbd>open</kbd>

```python
>>> f = fs.open("Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.简体&英文.ass", encoding="UTF-16")
>>> f
<_io.TextIOWrapper name='Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.简体&英文.ass' encoding='UTF-16'>
```

读取此文件的前 100 个字符

```python
>>> f.read(100)
'[Script Info]\n;SrtEdit 6.3.2012.1001\n;Copyright(C) 2005-2012 Yuan Weiguo\n\nTitle: YYeTs\nOriginal Scri'
```

用完后请及时关闭文件(其实不主动关闭也可以,只要文件不被引用,就会自动关闭)

```python
>>> f.close()
```

**以二进制模式打开一个文件,此时** `mode="rb"`

```python
>>> f = fs.open("Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv", "rb")
>>> f
p115.util.file.RequestsFileReader(<bound method P115PathBase.as_uri of <p115.P115Path(fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=2576931481024724685, path='/电视剧/欧美剧/A/A《爱、死亡和机器人》(Love.Death.and.Robot)[tt9561862]/爱、死亡和机器人S01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG(18集)') at 0x106825810>, path='/电视剧/欧美剧/A/A《爱、死亡和机器人》(Love.Death.and.Robot)[tt9561862]/爱、死亡和机器人S01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG(18集)/Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv', id=2576931481393823441, url='https://cdnfhnfile.115.com/5c8b637b499f7a09e4bb06f19b09585699f0423c/Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv?t=1703006667&u=306576686&s=104857600&d=vip-1862476304-djagtomczh64gx50u-1&c=2&f=1&k=f5ea224701acadd1bffad4a9200b23bd&us=1048576000&uc=10&v=1', url_expire_time=1703006667)>>, urlopen=<function RequestsFileReader.__init__.<locals>.urlopen_wrapper at 0x1068e2a20>, headers=mappingproxy({'Accept-Encoding': 'identity', 'Range': 'bytes=0-'}))
```

读取前 10 个字节

```python
>>> f.read(10)
b'\x1aE\xdf\xa3\xa3B\x86\x81\x01B'
```

再读取 10 个字节

```python
>>> f.read(10)
b'\xf7\x81\x01B\xf2\x81\x04B\xf3\x81'
```

当前文件偏移位置(从 0 开始计算)

```python
>>> f.tell()
20
```

把读取位置重新变为文件开头

```python
>>> f.seek(0)
0
>>> f.tell()
0
```

再次读取 20 字节,应该等于上面两次结果的拼接

```python
>>> f.read(20)
b'\x1aE\xdf\xa3\xa3B\x86\x81\x01B\xf7\x81\x01B\xf2\x81\x04B\xf3\x81'
>>> f.tell()
20
```

**回到根目录,我们继续其它试验**

```python
>>> fs.chdir("/")
0
```

**使用** <kbd>walk</kbd> **方法,可以遍历一个目录,参考** <kbd>os.walk</kbd>

```python
>>> next(fs.walk())
('/',
 ['云下载',
  '000阅读·乱七八糟',
  '电视剧',
  '电影',
  '纪录片',
  'libgen',
  '👾0号:重要资源',
  '📚1号:书籍大礼包',
  '📼资料备份'],
 [])
```

**使用** <kbd>walk_path</kbd> **方法,可以遍历一个目录时,获取** <kbd>p115.P115Path</kbd> 对象

```python
>>> next(fs.walk_path())
('/',
 [<p115.P115Path(name='云下载', is_directory=True, size=None, id=2593093001609739968, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 16, 21, 58, 22), utime=datetime.datetime(2023, 12, 19, 11, 29, 29), ptime=datetime.datetime(2023, 3, 18, 18, 52, 54), open_time=datetime.datetime(2023, 12, 19, 11, 29, 29), time=datetime.datetime(2023, 12, 16, 21, 58, 22), pick_code='fe1kl2mz1if2fl3wmx', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/云下载')>,
  <p115.P115Path(name='000阅读·乱七八糟', is_directory=True, size=None, id=2592968610464922758, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 38, 18), ptime=datetime.datetime(2023, 3, 18, 14, 45, 45), open_time=datetime.datetime(2023, 12, 14, 13, 17, 9), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccgz8vtu9xt08rmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/000阅读·乱七八糟')>,
  <p115.P115Path(name='电视剧', is_directory=True, size=None, id=2614100250469596984, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 48, 36), ptime=datetime.datetime(2023, 4, 16, 18, 30, 33), open_time=datetime.datetime(2023, 12, 15, 0, 48, 36), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdjemtliv9d5b55y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/电视剧')>,
  <p115.P115Path(name='电影', is_directory=True, size=None, id=2580587204111760961, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 0, 45), ptime=datetime.datetime(2023, 3, 1, 12, 46, 7), open_time=datetime.datetime(2023, 12, 12, 21, 56, 25), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdj4gtgvtd5p8q5y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/电影')>,
  <p115.P115Path(name='纪录片', is_directory=True, size=None, id=2576930424647319247, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 18, 18, 49, 29), utime=datetime.datetime(2023, 12, 18, 18, 49, 29), ptime=datetime.datetime(2023, 2, 24, 11, 40, 45), open_time=datetime.datetime(2023, 12, 13, 15, 45, 53), time=datetime.datetime(2023, 12, 18, 18, 49, 29), pick_code='fdjagt4u21x1k35y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/纪录片')>,
  <p115.P115Path(name='libgen', is_directory=True, size=None, id=2644648816430546428, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 18, 24, 57), ptime=datetime.datetime(2023, 5, 28, 22, 5, 6), open_time=datetime.datetime(2023, 12, 15, 18, 24, 57), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcid29t51koofbrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/libgen')>,
  <p115.P115Path(name='👾0号:重要资源', is_directory=True, size=None, id=2580131407544188592, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 45), ptime=datetime.datetime(2023, 2, 28, 21, 40, 32), open_time=datetime.datetime(2023, 12, 19, 11, 29, 45), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fa8p74ih0nu1ax4fyr', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/👾0号:重要资源')>,
  <p115.P115Path(name='📚1号:书籍大礼包', is_directory=True, size=None, id=2580246506904748007, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 44), ptime=datetime.datetime(2023, 3, 1, 1, 29, 12), open_time=datetime.datetime(2023, 12, 19, 11, 29, 44), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccqsmu7225f2vrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/📚1号:书籍大礼包')>,
  <p115.P115Path(name='📼资料备份', is_directory=True, size=None, id=2673432528538303699, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 12, 1), ptime=datetime.datetime(2023, 7, 7, 15, 13, 12), open_time=datetime.datetime(2023, 12, 15, 0, 12, 1), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcilznsigu2hczrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/📼资料备份')>],
 [])
```

**使用** <kbd>mkdir</kbd> **方法,可以创建空文件夹,参考** <kbd>os.mkdir</kbd>

```python
>>> fs.mkdir("test")
{'name': 'test',
 'is_directory': True,
 'size': None,
 'id': 2793068685969850230,
 'parent_id': 0,
 'sha1': None,
 'etime': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'utime': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'ptime': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'time': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'pick_code': 'fd4lr0lh0cqf525y6u',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 16, 48, 53, 571815),
 'path': '/test'}
```

名字中可以包含斜杠符号 `"/"`,但需要转义 `"\/"`(但我不建议在文件名中包含 `"/"`)

```python
>>> fs.mkdir("test\/2")
{'name': 'test/2',
 'is_directory': True,
 'size': None,
 'id': 2793068768899628939,
 'parent_id': 0,
 'sha1': None,
 'etime': datetime.datetime(2023, 12, 19, 16, 49, 3),
 'utime': datetime.datetime(2023, 12, 19, 16, 49, 3),
 'ptime': datetime.datetime(2023, 12, 19, 16, 49, 3),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'time': datetime.datetime(2023, 12, 19, 16, 49, 3),
 'pick_code': 'fd4lr0iehizqhn5y6u',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 3, 447470),
 'path': '/test\\/2'}
```

**使用** <kbd>rmdir</kbd> **方法,可以删除空文件夹,参考** <kbd>os.rmdir</kbd>

```python
>>> fs.rmdir("test")
{'name': 'test',
 'is_directory': True,
 'size': None,
 'id': 2793068685969850230,
 'parent_id': 0,
 'sha1': None,
 'etime': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'utime': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'ptime': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'time': datetime.datetime(2023, 12, 19, 16, 48, 53),
 'pick_code': 'fd4lr0lh0cqf525y6u',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 15, 896395),
 'path': '/test'}
```

**使用** <kbd>makedirs</kbd> **方法,可以创建多级的空目录,参考** <kbd>os.makedirs</kbd>

```python
>>> fs.makedirs("test\/2/test\/3/test\/4", exist_ok=True)
{'name': 'test/4',
 'is_directory': True,
 'size': None,
 'id': 2793068979713736021,
 'parent_id': 2793068974135311685,
 'sha1': None,
 'etime': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'utime': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'ptime': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'time': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'pick_code': 'fd4lr0njs9jm3d5y6u',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 28, 578537),
 'path': '/test\\/2/test\\/3/test\\/4'}
```

**使用** <kbd>removedirs</kbd> **方法,可以(自底向上地)删除多级的空目录,参考** <kbd>os.removedirs</kbd>

```python
>>> fs.removedirs("test\/2/test\/3/test\/4")
{'name': 'test/4',
 'is_directory': True,
 'size': None,
 'id': 2793068979713736021,
 'parent_id': 2793068974135311685,
 'sha1': None,
 'etime': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'utime': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'ptime': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'time': datetime.datetime(2023, 12, 19, 16, 49, 28),
 'pick_code': 'fd4lr0njs9jm3d5y6u',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 37, 830793),
 'path': '/test\\/2/test\\/3/test\\/4'}
```

**使用** <kbd>upload</kbd> **方法上传文件**

```python
>>> from io import BytesIO
>>> fs.upload(BytesIO(), "test.txt")
{'name': 'test.txt',
 'is_directory': False,
 'size': 0,
 'id': 2793075411108494446,
 'parent_id': 0,
 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',
 'etime': datetime.datetime(2023, 12, 19, 17, 2, 15),
 'utime': datetime.datetime(2023, 12, 19, 17, 2, 15),
 'ptime': datetime.datetime(2023, 12, 19, 17, 2, 15),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'pick_code': 'cwpyswv9pyja0dxt6',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 17, 2, 15, 355185),
 'path': '/test.txt'}
>>> fs.upload("file.py")
{'name': 'file.py',
 'is_directory': False,
 'size': 11927,
 'id': 2793075920607378515,
 'parent_id': 0,
 'sha1': 'C43B803A5F82E65BCAA9667F66939955CD0450CD',
 'etime': datetime.datetime(2023, 12, 19, 17, 3, 16),
 'utime': datetime.datetime(2023, 12, 19, 17, 3, 16),
 'ptime': datetime.datetime(2023, 12, 19, 17, 3, 16),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'pick_code': 'cwpysozr8a9andxt6',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 17, 3, 16, 204904),
 'path': '/file.py'}
```

**使用** <kbd>remove</kbd> **方法可以删除文件,参考** <kbd>os.remove</kbd>

```python
>>> fs.remove("test.txt")
{'name': 'test.txt',
 'is_directory': False,
 'size': 0,
 'id': 2793075411108494446,
 'parent_id': 0,
 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',
 'etime': datetime.datetime(2023, 12, 19, 17, 2, 15),
 'utime': datetime.datetime(2023, 12, 19, 17, 2, 15),
 'ptime': datetime.datetime(2023, 12, 19, 17, 2, 15),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'pick_code': 'cwpyswv9pyja0dxt6',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 17, 4, 25, 605253),
 'path': '/test.txt'}
```

**使用** <kbd>rmtree</kbd> **方法可以删除文件或文件夹,并且在删除文件夹时,也删除其中的文件和文件夹,参考** <kbd>shutil.rmtree</kbd>

```python
>>> fs.rmtree("file.py")
{'name': 'file.py',
 'is_directory': False,
 'size': 11927,
 'id': 2793075920607378515,
 'parent_id': 0,
 'sha1': 'C43B803A5F82E65BCAA9667F66939955CD0450CD',
 'etime': datetime.datetime(2023, 12, 19, 17, 3, 16),
 'utime': datetime.datetime(2023, 12, 19, 17, 3, 17),
 'ptime': datetime.datetime(2023, 12, 19, 17, 3, 16),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'pick_code': 'cwpysozr8a9andxt6',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 17, 5, 22, 766249),
 'path': '/file.py'}
```

**使用** <kbd>rename</kbd> **方法可以对文件或文件夹进行改名或移动,参考** <kbd>os.rename</kbd>

```python
>>> fs.touch("anyfile.mp3")
{'name': 'anyfile.mp3',
 'is_directory': False,
 'size': 0,
 'id': 2793077925249810265,
 'parent_id': 0,
 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',
 'etime': datetime.datetime(2023, 12, 19, 17, 7, 15),
 'utime': datetime.datetime(2023, 12, 19, 17, 7, 15),
 'ptime': datetime.datetime(2023, 12, 19, 17, 7, 15),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'pick_code': 'd47r0th5u0sfhx50u',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 17, 7, 15, 197968),
 'path': '/anyfile.mp3'}
>>> fs.rename("anyfile.mp3", "xyz.mp4")
{'name': 'xyz.mp4',
 'is_directory': False,
 'size': 0,
 'id': 2793078164048314194,
 'parent_id': 0,
 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',
 'etime': datetime.datetime(2023, 12, 19, 17, 7, 43),
 'utime': datetime.datetime(2023, 12, 19, 17, 7, 43),
 'ptime': datetime.datetime(2023, 12, 19, 17, 7, 43),
 'open_time': datetime.datetime(1970, 1, 1, 8, 0),
 'pick_code': 'e0bgvc5mdo6sxzlvx',
 'star': False,
 'lastest_update': datetime.datetime(2023, 12, 19, 17, 7, 43, 798793),
 'path': '/xyz.mp4'}
```

**使用** <kbd>renames</kbd> **方法可以对文件或文件夹进行改名或移动,并且在移动后如果原来所在目录为空,则会删除那个目录,参考** <kbd>os.renames</kbd>

**使用** <kbd>replace</kbd> **方法可以对文件或文件夹进行改名或移动,并且如果原始路径上是文件,目标路径上也存在一个文件,则会先把目标路径上的文件删除,参考** <kbd>os.replace</kbd>

**使用** <kbd>move</kbd> **方法可以对文件或文件夹进行改名或移动,目标路径存在且是一个目录,则把文件移动到其中(但是目录中有同名的文件或文件夹,还是会报错),参考** <kbd>shutil.move</kbd>

### 3. 遍历文件系统和查找文件

#### 1. 获取当前目录下所有 .mkv 文件的 url

**第 1 种方法,使用** <kbd>iter</kbd>,返回 <kbd>P115Path</kbd> 对象的迭代器

```python
for path in fs.iter(max_depth=-1):
    if path.name.endswith(".mkv"):
        print(path.url)
```

**第 2 种方法,使用** <kbd>glob</kbd>,参考 <kbd>pathlib.Path.glob</kbd> 和 <kbd>glob.iglob</kbd>,使用通配符查找

```python
for path in fs.glob("**/*.mkv"):
    print(path.url)
```

**第 3 种方法,使用** <kbd>rglob</kbd>,参考 <kbd>pathlib.Path.rglob</kbd>

```python
for path in fs.rglob("*.mkv"):
    print(path.url)
```

### 4. 针对分享链接的文件系统操作

<kbd>p115.P115ShareFileSystem</kbd> 实现了在<kbd>分享链接</kbd>上,只读的文件系统方法

<kbd>p115.P115SharePath</kbd> 实现了二次封装,从路径的角度来进行操作

**创建实例对象**

```python
from p115 import P115ShareFileSystem

share_link = "https://115.com/s/swzn4d53w8m?password=f247#"

share_fs = P115ShareFileSystem(client, share_link)
```

或者直接在 <kbd>client</kbd> 上就可获取

```python
share_fs = client.get_share_fs(share_link)
```

### 5. 针对压缩文件的文件系统操作

<kbd>p115.P115ZipFileSystem</kbd> 实现了在<kbd>压缩包</kbd>上,只读的文件系统方法

<kbd>p115.P115ZipPath</kbd> 实现了二次封装,从路径的角度来进行操作

**创建实例对象**

```python
from p115 import P115ZipFileSystem

pick_code = "abcdefg"

zip_fs = P115ZipFileSystem(client, pick_code)
```

或者直接在 <kbd>client</kbd> 上就可获取

```python
zip_fs = client.get_zip_fs(pick_code)
```

### 6. 针对云下载的封装

<kbd>p115.P115Offline</kbd> 实现了对于<kbd>云下载</kbd>的封装。

**创建实例对象**

```python
from p115 import P115Offline

offline = P115Offline(client)
```

或者直接在 <kbd>client</kbd> 上就可获取

```python
offline = client.offline
```

### 7. 针对回收站的封装

<kbd>p115.P115Recyclebin</kbd> 实现了对于<kbd>回收站</kbd>的封装。

**创建实例对象**

```python
from p115 import P115Recyclebin

recyclebin = P115Recyclebin(client)
```

或者直接在 <kbd>client</kbd> 上就可获取

```python
recyclebin = client.recyclebin
```

### 8. 针对分享的封装

<kbd>p115.P115Sharing</kbd> 实现了对于<kbd>分享记录</kbd>的封装。

**创建实例对象**

```python
from p115 import P115Sharing

sharing = P115Sharing(client)
```

或者直接在 <kbd>client</kbd> 上就可获取

```python
sharing = client.sharing
```

## 文档

> 正在编写中

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-115-client",
    "name": "python-115",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "nas, 115",
    "author": "ChenyangGao",
    "author_email": "wosiwujm@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/31/08/b4b3f08649e7d451730dd9c5aadc4bf81a46d03f1949271eadf6d7e97a3d/python_115-0.0.5.11.tar.gz",
    "platform": null,
    "description": "# 115 \u7f51\u76d8 Web API \u7684 Python \u5c01\u88c5\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-115)\n![PyPI - Version](https://img.shields.io/pypi/v/python-115)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/python-115)\n![PyPI - Format](https://img.shields.io/pypi/format/python-115)\n![PyPI - Status](https://img.shields.io/pypi/status/python-115)\n\n## \u5b89\u88c5\n\n\u901a\u8fc7 [pypi](https://pypi.org/project/python-115/)\n\n```console\npip install -U python-115\n```\n\n## \u5165\u95e8\u4ecb\u7ecd\n\n### 1. \u5bfc\u5165\u6a21\u5757\u548c\u521b\u5efa\u5b9e\u4f8b\n\n**\u5bfc\u5165\u6a21\u5757**\n\n```python\nfrom p115 import P115Client, P115FileSystem\n```\n\n**\u521b\u5efa\u5ba2\u6237\u7aef\u5bf9\u8c61\uff0c\u9700\u8981\u4f20\u5165 <kbd>cookie</kbd>\uff0c\u5982\u679c\u4e0d\u4f20\u6216\u8005 <kbd>cookie</kbd> \u5931\u6548\uff0c\u5219\u9700\u8981\u626b\u7801\u767b\u5f55**\n\n```python\ncookie = \"UID=...;CID=...;SEID=...\"\nclient = P115Client(cookie)\n```\n\n**\u521b\u5efa\u6587\u4ef6\u7cfb\u7edf\u5bf9\u8c61**\n\n```python\nfs = P115FileSystem(client)\n```\n\n\u6216\u8005\u76f4\u63a5\u5728 <kbd>client</kbd> \u4e0a\u5c31\u53ef\u83b7\u53d6\u6587\u4ef6\u7cfb\u7edf\u5bf9\u8c61\n\n```python\nfs = client.fs\n```\n\n### 2. \u64cd\u4f5c\u7f51\u76d8\u4f7f\u7528 Python \u5f0f\u7684\u6587\u4ef6\u7cfb\u7edf\u65b9\u6cd5\n\n\u6587\u4ef6\u7cfb\u7edf\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0c\u8bbe\u8ba1\u548c\u884c\u4e3a\u53c2\u8003\u4e86 <kbd>[os](https://docs.python.org/3/library/os.html)</kbd>\u3001<kbd>[posixpath](https://docs.python.org/3/library/os.path.html)</kbd>\u3001<kbd>[pathlib.Path](https://docs.python.org/3/library/pathlib.html)</kbd> \u548c <kbd>[shutil](https://docs.python.org/3/library/shutil.html)</kbd> \u7b49\u6a21\u5757\u3002\n\n<kbd>p115.P115FileSystem</kbd> \u5b9e\u73b0\u4e86\u5728\u81ea\u5df1\u7684\u7f51\u76d8\u4e0a\uff0c\u8bfb\u5199\u7684\u6587\u4ef6\u7cfb\u7edf\u65b9\u6cd5\n\n<kbd>p115.P115Path</kbd> \u5b9e\u73b0\u4e86\u4e8c\u6b21\u5c01\u88c5\uff0c\u4ece\u8def\u5f84\u7684\u89d2\u5ea6\u6765\u8fdb\u884c\u64cd\u4f5c\u3002\n\n**\u4f7f\u7528** <kbd>getcwd</kbd> **\u65b9\u6cd5\uff0c\u83b7\u53d6\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u7684\u8def\u5f84\uff0c\u53c2\u8003** <kbd>os.getcwd</kbd>\n\n```python\n>>> fs.getcwd()\n'/'\n```\n\n**\u4f7f\u7528** <kbd>getcid</kbd> **\u65b9\u6cd5\uff0c\u83b7\u53d6\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u7684 id**\n\n```python\n>>> fs.getcid()\n0\n```\n\n**\u4f7f\u7528** <kbd>listdir</kbd> **\u65b9\u6cd5\uff0c\u7f57\u5217\u5f53\u524d\u76ee\u5f55\u7684\u6587\u4ef6\u540d\uff0c\u53c2\u8003** <kbd>os.listdir</kbd>\n\n```python\n>>> fs.listdir()\n['\u4e91\u4e0b\u8f7d',\n '000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf',\n '\u7535\u89c6\u5267',\n '\u7535\u5f71',\n '\u7eaa\u5f55\u7247',\n 'libgen',\n '\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90',\n '\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305',\n '\ud83d\udcfc\u8d44\u6599\u5907\u4efd']\n```\n\n**\u4f7f\u7528** <kbd>listdir_attr</kbd> **\u65b9\u6cd5\uff0c\u7f57\u5217\u5f53\u524d\u76ee\u5f55\u65f6\uff0c\u8fd8\u53ef\u4ee5\u83b7\u53d6\u5c5e\u6027**\n\n```python\n>>> fs.listdir_attr()\n[{'name': '\u4e91\u4e0b\u8f7d',\n  'is_directory': True,\n  'size': None,\n  'id': 2593093001609739968,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 16, 21, 58, 22),\n  'utime': datetime.datetime(2023, 12, 19, 11, 29, 29),\n  'ptime': datetime.datetime(2023, 3, 18, 18, 52, 54),\n  'open_time': datetime.datetime(2023, 12, 19, 11, 29, 29),\n  'time': datetime.datetime(2023, 12, 16, 21, 58, 22),\n  'pick_code': 'fe1kl2mz1if2fl3wmx',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/\u4e91\u4e0b\u8f7d'},\n {'name': '000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf',\n  'is_directory': True,\n  'size': None,\n  'id': 2592968610464922758,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'utime': datetime.datetime(2023, 12, 14, 15, 38, 18),\n  'ptime': datetime.datetime(2023, 3, 18, 14, 45, 45),\n  'open_time': datetime.datetime(2023, 12, 14, 13, 17, 9),\n  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'pick_code': 'fccgz8vtu9xt08rmt6',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf'},\n {'name': '\u7535\u89c6\u5267',\n  'is_directory': True,\n  'size': None,\n  'id': 2614100250469596984,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'utime': datetime.datetime(2023, 12, 15, 0, 48, 36),\n  'ptime': datetime.datetime(2023, 4, 16, 18, 30, 33),\n  'open_time': datetime.datetime(2023, 12, 15, 0, 48, 36),\n  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'pick_code': 'fdjemtliv9d5b55y6u',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/\u7535\u89c6\u5267'},\n {'name': '\u7535\u5f71',\n  'is_directory': True,\n  'size': None,\n  'id': 2580587204111760961,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'utime': datetime.datetime(2023, 12, 14, 15, 0, 45),\n  'ptime': datetime.datetime(2023, 3, 1, 12, 46, 7),\n  'open_time': datetime.datetime(2023, 12, 12, 21, 56, 25),\n  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'pick_code': 'fdj4gtgvtd5p8q5y6u',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/\u7535\u5f71'},\n {'name': '\u7eaa\u5f55\u7247',\n  'is_directory': True,\n  'size': None,\n  'id': 2576930424647319247,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 18, 18, 49, 29),\n  'utime': datetime.datetime(2023, 12, 18, 18, 49, 29),\n  'ptime': datetime.datetime(2023, 2, 24, 11, 40, 45),\n  'open_time': datetime.datetime(2023, 12, 13, 15, 45, 53),\n  'time': datetime.datetime(2023, 12, 18, 18, 49, 29),\n  'pick_code': 'fdjagt4u21x1k35y6u',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/\u7eaa\u5f55\u7247'},\n {'name': 'libgen',\n  'is_directory': True,\n  'size': None,\n  'id': 2644648816430546428,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'utime': datetime.datetime(2023, 12, 15, 18, 24, 57),\n  'ptime': datetime.datetime(2023, 5, 28, 22, 5, 6),\n  'open_time': datetime.datetime(2023, 12, 15, 18, 24, 57),\n  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'pick_code': 'fcid29t51koofbrmt6',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/libgen'},\n {'name': '\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90',\n  'is_directory': True,\n  'size': None,\n  'id': 2580131407544188592,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'utime': datetime.datetime(2023, 12, 19, 11, 29, 45),\n  'ptime': datetime.datetime(2023, 2, 28, 21, 40, 32),\n  'open_time': datetime.datetime(2023, 12, 19, 11, 29, 45),\n  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'pick_code': 'fa8p74ih0nu1ax4fyr',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90'},\n {'name': '\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305',\n  'is_directory': True,\n  'size': None,\n  'id': 2580246506904748007,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'utime': datetime.datetime(2023, 12, 19, 11, 29, 44),\n  'ptime': datetime.datetime(2023, 3, 1, 1, 29, 12),\n  'open_time': datetime.datetime(2023, 12, 19, 11, 29, 44),\n  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'pick_code': 'fccqsmu7225f2vrmt6',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305'},\n {'name': '\ud83d\udcfc\u8d44\u6599\u5907\u4efd',\n  'is_directory': True,\n  'size': None,\n  'id': 2673432528538303699,\n  'parent_id': 0,\n  'sha1': None,\n  'etime': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'utime': datetime.datetime(2023, 12, 15, 0, 12, 1),\n  'ptime': datetime.datetime(2023, 7, 7, 15, 13, 12),\n  'open_time': datetime.datetime(2023, 12, 15, 0, 12, 1),\n  'time': datetime.datetime(2023, 12, 14, 14, 54, 20),\n  'pick_code': 'fcilznsigu2hczrmt6',\n  'star': False,\n  'lastest_update': datetime.datetime(2023, 12, 19, 11, 30, 7, 517017),\n  'path': '/\ud83d\udcfc\u8d44\u6599\u5907\u4efd'}]\n```\n\n**\u4f7f\u7528** <kbd>listdir_path</kbd> **\u65b9\u6cd5\uff0c\u7f57\u5217\u5f53\u524d\u76ee\u5f55\u65f6\uff0c\u8fd8\u53ef\u4ee5\u83b7\u53d6** <kbd>p115.P115Path</kbd> **\u5bf9\u8c61**\n\n```python\n[<p115.P115Path(name='\u4e91\u4e0b\u8f7d', is_directory=True, size=None, id=2593093001609739968, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 16, 21, 58, 22), utime=datetime.datetime(2023, 12, 19, 11, 29, 29), ptime=datetime.datetime(2023, 3, 18, 18, 52, 54), open_time=datetime.datetime(2023, 12, 19, 11, 29, 29), time=datetime.datetime(2023, 12, 16, 21, 58, 22), pick_code='fe1kl2mz1if2fl3wmx', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/\u4e91\u4e0b\u8f7d')>,\n <p115.P115Path(name='000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf', is_directory=True, size=None, id=2592968610464922758, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 38, 18), ptime=datetime.datetime(2023, 3, 18, 14, 45, 45), open_time=datetime.datetime(2023, 12, 14, 13, 17, 9), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccgz8vtu9xt08rmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf')>,\n <p115.P115Path(name='\u7535\u89c6\u5267', is_directory=True, size=None, id=2614100250469596984, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 48, 36), ptime=datetime.datetime(2023, 4, 16, 18, 30, 33), open_time=datetime.datetime(2023, 12, 15, 0, 48, 36), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdjemtliv9d5b55y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/\u7535\u89c6\u5267')>,\n <p115.P115Path(name='\u7535\u5f71', is_directory=True, size=None, id=2580587204111760961, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 0, 45), ptime=datetime.datetime(2023, 3, 1, 12, 46, 7), open_time=datetime.datetime(2023, 12, 12, 21, 56, 25), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdj4gtgvtd5p8q5y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/\u7535\u5f71')>,\n <p115.P115Path(name='\u7eaa\u5f55\u7247', is_directory=True, size=None, id=2576930424647319247, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 18, 18, 49, 29), utime=datetime.datetime(2023, 12, 18, 18, 49, 29), ptime=datetime.datetime(2023, 2, 24, 11, 40, 45), open_time=datetime.datetime(2023, 12, 13, 15, 45, 53), time=datetime.datetime(2023, 12, 18, 18, 49, 29), pick_code='fdjagt4u21x1k35y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/\u7eaa\u5f55\u7247')>,\n <p115.P115Path(name='libgen', is_directory=True, size=None, id=2644648816430546428, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 18, 24, 57), ptime=datetime.datetime(2023, 5, 28, 22, 5, 6), open_time=datetime.datetime(2023, 12, 15, 18, 24, 57), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcid29t51koofbrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/libgen')>,\n <p115.P115Path(name='\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90', is_directory=True, size=None, id=2580131407544188592, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 45), ptime=datetime.datetime(2023, 2, 28, 21, 40, 32), open_time=datetime.datetime(2023, 12, 19, 11, 29, 45), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fa8p74ih0nu1ax4fyr', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90')>,\n <p115.P115Path(name='\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305', is_directory=True, size=None, id=2580246506904748007, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 44), ptime=datetime.datetime(2023, 3, 1, 1, 29, 12), open_time=datetime.datetime(2023, 12, 19, 11, 29, 44), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccqsmu7225f2vrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305')>,\n <p115.P115Path(name='\ud83d\udcfc\u8d44\u6599\u5907\u4efd', is_directory=True, size=None, id=2673432528538303699, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 12, 1), ptime=datetime.datetime(2023, 7, 7, 15, 13, 12), open_time=datetime.datetime(2023, 12, 15, 0, 12, 1), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcilznsigu2hczrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 11, 32, 18, 778700), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x106dcb190>, cid=0, path='/') at 0x108b21b90>, path='/\ud83d\udcfc\u8d44\u6599\u5907\u4efd')>]\n```\n\n**\u4f7f\u7528** <kbd>chdir</kbd> **\u65b9\u6cd5\uff0c\u8fdb\u5165\u67d0\u4e2a\u76ee\u5f55\uff0c\u5c31\u50cf** <kbd>os.chdir</kbd>\n\n```python\n>>> fs.chdir(\"\u7535\u89c6\u5267/\u6b27\u7f8e\u5267/A\")\n2598195078816071040\n>>> fs.getcwd()\n'/\u7535\u89c6\u5267/\u6b27\u7f8e\u5267/A'\n>>> fs.getcid()\n2598195078816071040\n>>> fs.listdir()\n['A\u300a\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4eba\u300b(Love.Death.and.Robot)[tt9561862]']\n>>> fs.chdir(\"A\u300a\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4eba\u300b(Love.Death.and.Robot)[tt9561862]/\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4ebaS01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG\uff0818\u96c6\uff09\")\n2576931481024724685\n>>> fs.listdir()\n['Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.\u7b80\u4f53&\u82f1\u6587.ass', 'Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv']\n```\n\n**\u4f7f\u7528** <kbd>attr</kbd> **\u65b9\u6cd5\uff0c\u83b7\u53d6\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u7684\u5c5e\u6027** \n\n```python\n>>> fs.attr(\"Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv\")\n{'name': 'Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv',\n 'is_directory': False,\n 'size': 924544482,\n 'id': 2576931481393823441,\n 'parent_id': 2576931481024724685,\n 'sha1': '7F4121B68A4E467ABF30A84627E20A8978895A4E',\n 'etime': datetime.datetime(2023, 2, 24, 11, 42, 51),\n 'utime': datetime.datetime(2023, 12, 19, 0, 21, 42),\n 'ptime': datetime.datetime(2023, 2, 24, 11, 42, 51),\n 'open_time': datetime.datetime(2023, 7, 7, 0, 50, 30),\n 'pick_code': 'djagtomczh64gx50u',\n 'star': False,\n 'play_long': 1034,\n 'lastest_update': datetime.datetime(2023, 12, 19, 11, 41, 34, 914934),\n 'path': '/\u7535\u89c6\u5267/\u6b27\u7f8e\u5267/A/A\u300a\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4eba\u300b(Love.Death.and.Robot)[tt9561862]/\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4ebaS01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG\uff0818\u96c6\uff09/Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv'}\n```\n\n**\u4f7f\u7528** <kbd>stat</kbd> **\u65b9\u6cd5\uff0c\u83b7\u53d6\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u7684\u90e8\u5206\uff0c\u53c2\u8003** <kbd>os.stat</kbd>\n\n```python\n>>> fs.stat(\"Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv\")\nos.stat_result(st_mode=33279, st_ino=2576931481393823441, st_dev=2576931481024724685, st_nlink=1, st_uid=306576686, st_gid=1, st_size=924544482, st_atime=1688662230.0, st_mtime=1677210171.0, st_ctime=1677210171.0)\n```\n\n**\u4f7f\u7528** <kbd>open</kbd> **\u65b9\u6cd5\uff0c\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\uff08\u76ee\u524d\u53ea\u652f\u6301\u8bfb\u53d6\uff0c\u4e0d\u652f\u6301\u5199\u5165\uff09\uff0c\u53c2\u8003** <kbd>open</kbd>\n\n```python\n>>> f = fs.open(\"Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.\u7b80\u4f53&\u82f1\u6587.ass\", encoding=\"UTF-16\")\n>>> f\n<_io.TextIOWrapper name='Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.\u7b80\u4f53&\u82f1\u6587.ass' encoding='UTF-16'>\n```\n\n\u8bfb\u53d6\u6b64\u6587\u4ef6\u7684\u524d 100 \u4e2a\u5b57\u7b26\n\n```python\n>>> f.read(100)\n'[Script Info]\\n;SrtEdit 6.3.2012.1001\\n;Copyright(C) 2005-2012 Yuan Weiguo\\n\\nTitle: YYeTs\\nOriginal Scri'\n```\n\n\u7528\u5b8c\u540e\u8bf7\u53ca\u65f6\u5173\u95ed\u6587\u4ef6\uff08\u5176\u5b9e\u4e0d\u4e3b\u52a8\u5173\u95ed\u4e5f\u53ef\u4ee5\uff0c\u53ea\u8981\u6587\u4ef6\u4e0d\u88ab\u5f15\u7528\uff0c\u5c31\u4f1a\u81ea\u52a8\u5173\u95ed\uff09\n\n```python\n>>> f.close()\n```\n\n**\u4ee5\u4e8c\u8fdb\u5236\u6a21\u5f0f\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\uff0c\u6b64\u65f6** `mode=\"rb\"`\n\n```python\n>>> f = fs.open(\"Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv\", \"rb\")\n>>> f\np115.util.file.RequestsFileReader(<bound method P115PathBase.as_uri of <p115.P115Path(fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=2576931481024724685, path='/\u7535\u89c6\u5267/\u6b27\u7f8e\u5267/A/A\u300a\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4eba\u300b(Love.Death.and.Robot)[tt9561862]/\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4ebaS01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG\uff0818\u96c6\uff09') at 0x106825810>, path='/\u7535\u89c6\u5267/\u6b27\u7f8e\u5267/A/A\u300a\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4eba\u300b(Love.Death.and.Robot)[tt9561862]/\u7231\u3001\u6b7b\u4ea1\u548c\u673a\u5668\u4ebaS01.Love.Death.and.Robots.1080p.NF.WEB-DL.DDP5.1.x264-NTG\uff0818\u96c6\uff09/Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv', id=2576931481393823441, url='https://cdnfhnfile.115.com/5c8b637b499f7a09e4bb06f19b09585699f0423c/Love.Death.and.Robots.S01E01.Sonnies.Edge.1080p.NF.WEB-DL.DDP5.1.x264-NTG.mkv?t=1703006667&u=306576686&s=104857600&d=vip-1862476304-djagtomczh64gx50u-1&c=2&f=1&k=f5ea224701acadd1bffad4a9200b23bd&us=1048576000&uc=10&v=1', url_expire_time=1703006667)>>, urlopen=<function RequestsFileReader.__init__.<locals>.urlopen_wrapper at 0x1068e2a20>, headers=mappingproxy({'Accept-Encoding': 'identity', 'Range': 'bytes=0-'}))\n```\n\n\u8bfb\u53d6\u524d 10 \u4e2a\u5b57\u8282\n\n```python\n>>> f.read(10)\nb'\\x1aE\\xdf\\xa3\\xa3B\\x86\\x81\\x01B'\n```\n\n\u518d\u8bfb\u53d6 10 \u4e2a\u5b57\u8282\n\n```python\n>>> f.read(10)\nb'\\xf7\\x81\\x01B\\xf2\\x81\\x04B\\xf3\\x81'\n```\n\n\u5f53\u524d\u6587\u4ef6\u504f\u79fb\u4f4d\u7f6e\uff08\u4ece 0 \u5f00\u59cb\u8ba1\u7b97\uff09\n\n```python\n>>> f.tell()\n20\n```\n\n\u628a\u8bfb\u53d6\u4f4d\u7f6e\u91cd\u65b0\u53d8\u4e3a\u6587\u4ef6\u5f00\u5934\n\n```python\n>>> f.seek(0)\n0\n>>> f.tell()\n0\n```\n\n\u518d\u6b21\u8bfb\u53d6 20 \u5b57\u8282\uff0c\u5e94\u8be5\u7b49\u4e8e\u4e0a\u9762\u4e24\u6b21\u7ed3\u679c\u7684\u62fc\u63a5\n\n```python\n>>> f.read(20)\nb'\\x1aE\\xdf\\xa3\\xa3B\\x86\\x81\\x01B\\xf7\\x81\\x01B\\xf2\\x81\\x04B\\xf3\\x81'\n>>> f.tell()\n20\n```\n\n**\u56de\u5230\u6839\u76ee\u5f55\uff0c\u6211\u4eec\u7ee7\u7eed\u5176\u5b83\u8bd5\u9a8c**\n\n```python\n>>> fs.chdir(\"/\")\n0\n```\n\n**\u4f7f\u7528** <kbd>walk</kbd> **\u65b9\u6cd5\uff0c\u53ef\u4ee5\u904d\u5386\u4e00\u4e2a\u76ee\u5f55\uff0c\u53c2\u8003** <kbd>os.walk</kbd>\n\n```python\n>>> next(fs.walk())\n('/',\n ['\u4e91\u4e0b\u8f7d',\n  '000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf',\n  '\u7535\u89c6\u5267',\n  '\u7535\u5f71',\n  '\u7eaa\u5f55\u7247',\n  'libgen',\n  '\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90',\n  '\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305',\n  '\ud83d\udcfc\u8d44\u6599\u5907\u4efd'],\n [])\n```\n\n**\u4f7f\u7528** <kbd>walk_path</kbd> **\u65b9\u6cd5\uff0c\u53ef\u4ee5\u904d\u5386\u4e00\u4e2a\u76ee\u5f55\u65f6\uff0c\u83b7\u53d6** <kbd>p115.P115Path</kbd> \u5bf9\u8c61\n\n```python\n>>> next(fs.walk_path())\n('/',\n [<p115.P115Path(name='\u4e91\u4e0b\u8f7d', is_directory=True, size=None, id=2593093001609739968, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 16, 21, 58, 22), utime=datetime.datetime(2023, 12, 19, 11, 29, 29), ptime=datetime.datetime(2023, 3, 18, 18, 52, 54), open_time=datetime.datetime(2023, 12, 19, 11, 29, 29), time=datetime.datetime(2023, 12, 16, 21, 58, 22), pick_code='fe1kl2mz1if2fl3wmx', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/\u4e91\u4e0b\u8f7d')>,\n  <p115.P115Path(name='000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf', is_directory=True, size=None, id=2592968610464922758, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 38, 18), ptime=datetime.datetime(2023, 3, 18, 14, 45, 45), open_time=datetime.datetime(2023, 12, 14, 13, 17, 9), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccgz8vtu9xt08rmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/000\u9605\u8bfb\u00b7\u4e71\u4e03\u516b\u7cdf')>,\n  <p115.P115Path(name='\u7535\u89c6\u5267', is_directory=True, size=None, id=2614100250469596984, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 48, 36), ptime=datetime.datetime(2023, 4, 16, 18, 30, 33), open_time=datetime.datetime(2023, 12, 15, 0, 48, 36), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdjemtliv9d5b55y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/\u7535\u89c6\u5267')>,\n  <p115.P115Path(name='\u7535\u5f71', is_directory=True, size=None, id=2580587204111760961, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 14, 15, 0, 45), ptime=datetime.datetime(2023, 3, 1, 12, 46, 7), open_time=datetime.datetime(2023, 12, 12, 21, 56, 25), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fdj4gtgvtd5p8q5y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/\u7535\u5f71')>,\n  <p115.P115Path(name='\u7eaa\u5f55\u7247', is_directory=True, size=None, id=2576930424647319247, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 18, 18, 49, 29), utime=datetime.datetime(2023, 12, 18, 18, 49, 29), ptime=datetime.datetime(2023, 2, 24, 11, 40, 45), open_time=datetime.datetime(2023, 12, 13, 15, 45, 53), time=datetime.datetime(2023, 12, 18, 18, 49, 29), pick_code='fdjagt4u21x1k35y6u', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/\u7eaa\u5f55\u7247')>,\n  <p115.P115Path(name='libgen', is_directory=True, size=None, id=2644648816430546428, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 18, 24, 57), ptime=datetime.datetime(2023, 5, 28, 22, 5, 6), open_time=datetime.datetime(2023, 12, 15, 18, 24, 57), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcid29t51koofbrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/libgen')>,\n  <p115.P115Path(name='\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90', is_directory=True, size=None, id=2580131407544188592, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 45), ptime=datetime.datetime(2023, 2, 28, 21, 40, 32), open_time=datetime.datetime(2023, 12, 19, 11, 29, 45), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fa8p74ih0nu1ax4fyr', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/\ud83d\udc7e0\u53f7\uff1a\u91cd\u8981\u8d44\u6e90')>,\n  <p115.P115Path(name='\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305', is_directory=True, size=None, id=2580246506904748007, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 19, 11, 29, 44), ptime=datetime.datetime(2023, 3, 1, 1, 29, 12), open_time=datetime.datetime(2023, 12, 19, 11, 29, 44), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fccqsmu7225f2vrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/\ud83d\udcda1\u53f7\uff1a\u4e66\u7c4d\u5927\u793c\u5305')>,\n  <p115.P115Path(name='\ud83d\udcfc\u8d44\u6599\u5907\u4efd', is_directory=True, size=None, id=2673432528538303699, parent_id=0, sha1=None, etime=datetime.datetime(2023, 12, 14, 14, 54, 20), utime=datetime.datetime(2023, 12, 15, 0, 12, 1), ptime=datetime.datetime(2023, 7, 7, 15, 13, 12), open_time=datetime.datetime(2023, 12, 15, 0, 12, 1), time=datetime.datetime(2023, 12, 14, 14, 54, 20), pick_code='fcilznsigu2hczrmt6', star=False, lastest_update=datetime.datetime(2023, 12, 19, 12, 43, 23, 433377), fs=<p115.P115FileSystem(client=<p115.P115Client object at 0x104e86050>, cid=0, path='/') at 0x106825810>, path='/\ud83d\udcfc\u8d44\u6599\u5907\u4efd')>],\n [])\n```\n\n**\u4f7f\u7528** <kbd>mkdir</kbd> **\u65b9\u6cd5\uff0c\u53ef\u4ee5\u521b\u5efa\u7a7a\u6587\u4ef6\u5939\uff0c\u53c2\u8003** <kbd>os.mkdir</kbd>\n\n```python\n>>> fs.mkdir(\"test\")\n{'name': 'test',\n 'is_directory': True,\n 'size': None,\n 'id': 2793068685969850230,\n 'parent_id': 0,\n 'sha1': None,\n 'etime': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'utime': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'ptime': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'time': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'pick_code': 'fd4lr0lh0cqf525y6u',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 16, 48, 53, 571815),\n 'path': '/test'}\n```\n\n\u540d\u5b57\u4e2d\u53ef\u4ee5\u5305\u542b\u659c\u6760\u7b26\u53f7 `\"/\"`\uff0c\u4f46\u9700\u8981\u8f6c\u4e49 `\"\\/\"`\uff08\u4f46\u6211\u4e0d\u5efa\u8bae\u5728\u6587\u4ef6\u540d\u4e2d\u5305\u542b `\"/\"`\uff09\n\n```python\n>>> fs.mkdir(\"test\\/2\")\n{'name': 'test/2',\n 'is_directory': True,\n 'size': None,\n 'id': 2793068768899628939,\n 'parent_id': 0,\n 'sha1': None,\n 'etime': datetime.datetime(2023, 12, 19, 16, 49, 3),\n 'utime': datetime.datetime(2023, 12, 19, 16, 49, 3),\n 'ptime': datetime.datetime(2023, 12, 19, 16, 49, 3),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'time': datetime.datetime(2023, 12, 19, 16, 49, 3),\n 'pick_code': 'fd4lr0iehizqhn5y6u',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 3, 447470),\n 'path': '/test\\\\/2'}\n```\n\n**\u4f7f\u7528** <kbd>rmdir</kbd> **\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5220\u9664\u7a7a\u6587\u4ef6\u5939\uff0c\u53c2\u8003** <kbd>os.rmdir</kbd>\n\n```python\n>>> fs.rmdir(\"test\")\n{'name': 'test',\n 'is_directory': True,\n 'size': None,\n 'id': 2793068685969850230,\n 'parent_id': 0,\n 'sha1': None,\n 'etime': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'utime': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'ptime': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'time': datetime.datetime(2023, 12, 19, 16, 48, 53),\n 'pick_code': 'fd4lr0lh0cqf525y6u',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 15, 896395),\n 'path': '/test'}\n```\n\n**\u4f7f\u7528** <kbd>makedirs</kbd> **\u65b9\u6cd5\uff0c\u53ef\u4ee5\u521b\u5efa\u591a\u7ea7\u7684\u7a7a\u76ee\u5f55\uff0c\u53c2\u8003** <kbd>os.makedirs</kbd>\n\n```python\n>>> fs.makedirs(\"test\\/2/test\\/3/test\\/4\", exist_ok=True)\n{'name': 'test/4',\n 'is_directory': True,\n 'size': None,\n 'id': 2793068979713736021,\n 'parent_id': 2793068974135311685,\n 'sha1': None,\n 'etime': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'utime': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'ptime': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'time': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'pick_code': 'fd4lr0njs9jm3d5y6u',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 28, 578537),\n 'path': '/test\\\\/2/test\\\\/3/test\\\\/4'}\n```\n\n**\u4f7f\u7528** <kbd>removedirs</kbd> **\u65b9\u6cd5\uff0c\u53ef\u4ee5\uff08\u81ea\u5e95\u5411\u4e0a\u5730\uff09\u5220\u9664\u591a\u7ea7\u7684\u7a7a\u76ee\u5f55\uff0c\u53c2\u8003** <kbd>os.removedirs</kbd>\n\n```python\n>>> fs.removedirs(\"test\\/2/test\\/3/test\\/4\")\n{'name': 'test/4',\n 'is_directory': True,\n 'size': None,\n 'id': 2793068979713736021,\n 'parent_id': 2793068974135311685,\n 'sha1': None,\n 'etime': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'utime': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'ptime': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'time': datetime.datetime(2023, 12, 19, 16, 49, 28),\n 'pick_code': 'fd4lr0njs9jm3d5y6u',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 16, 49, 37, 830793),\n 'path': '/test\\\\/2/test\\\\/3/test\\\\/4'}\n```\n\n**\u4f7f\u7528** <kbd>upload</kbd> **\u65b9\u6cd5\u4e0a\u4f20\u6587\u4ef6**\n\n```python\n>>> from io import BytesIO\n>>> fs.upload(BytesIO(), \"test.txt\")\n{'name': 'test.txt',\n 'is_directory': False,\n 'size': 0,\n 'id': 2793075411108494446,\n 'parent_id': 0,\n 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',\n 'etime': datetime.datetime(2023, 12, 19, 17, 2, 15),\n 'utime': datetime.datetime(2023, 12, 19, 17, 2, 15),\n 'ptime': datetime.datetime(2023, 12, 19, 17, 2, 15),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'pick_code': 'cwpyswv9pyja0dxt6',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 17, 2, 15, 355185),\n 'path': '/test.txt'}\n>>> fs.upload(\"file.py\")\n{'name': 'file.py',\n 'is_directory': False,\n 'size': 11927,\n 'id': 2793075920607378515,\n 'parent_id': 0,\n 'sha1': 'C43B803A5F82E65BCAA9667F66939955CD0450CD',\n 'etime': datetime.datetime(2023, 12, 19, 17, 3, 16),\n 'utime': datetime.datetime(2023, 12, 19, 17, 3, 16),\n 'ptime': datetime.datetime(2023, 12, 19, 17, 3, 16),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'pick_code': 'cwpysozr8a9andxt6',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 17, 3, 16, 204904),\n 'path': '/file.py'}\n```\n\n**\u4f7f\u7528** <kbd>remove</kbd> **\u65b9\u6cd5\u53ef\u4ee5\u5220\u9664\u6587\u4ef6\uff0c\u53c2\u8003** <kbd>os.remove</kbd>\n\n```python\n>>> fs.remove(\"test.txt\")\n{'name': 'test.txt',\n 'is_directory': False,\n 'size': 0,\n 'id': 2793075411108494446,\n 'parent_id': 0,\n 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',\n 'etime': datetime.datetime(2023, 12, 19, 17, 2, 15),\n 'utime': datetime.datetime(2023, 12, 19, 17, 2, 15),\n 'ptime': datetime.datetime(2023, 12, 19, 17, 2, 15),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'pick_code': 'cwpyswv9pyja0dxt6',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 17, 4, 25, 605253),\n 'path': '/test.txt'}\n```\n\n**\u4f7f\u7528** <kbd>rmtree</kbd> **\u65b9\u6cd5\u53ef\u4ee5\u5220\u9664\u6587\u4ef6\u6216\u6587\u4ef6\u5939\uff0c\u5e76\u4e14\u5728\u5220\u9664\u6587\u4ef6\u5939\u65f6\uff0c\u4e5f\u5220\u9664\u5176\u4e2d\u7684\u6587\u4ef6\u548c\u6587\u4ef6\u5939\uff0c\u53c2\u8003** <kbd>shutil.rmtree</kbd>\n\n```python\n>>> fs.rmtree(\"file.py\")\n{'name': 'file.py',\n 'is_directory': False,\n 'size': 11927,\n 'id': 2793075920607378515,\n 'parent_id': 0,\n 'sha1': 'C43B803A5F82E65BCAA9667F66939955CD0450CD',\n 'etime': datetime.datetime(2023, 12, 19, 17, 3, 16),\n 'utime': datetime.datetime(2023, 12, 19, 17, 3, 17),\n 'ptime': datetime.datetime(2023, 12, 19, 17, 3, 16),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'pick_code': 'cwpysozr8a9andxt6',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 17, 5, 22, 766249),\n 'path': '/file.py'}\n```\n\n**\u4f7f\u7528** <kbd>rename</kbd> **\u65b9\u6cd5\u53ef\u4ee5\u5bf9\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u8fdb\u884c\u6539\u540d\u6216\u79fb\u52a8\uff0c\u53c2\u8003** <kbd>os.rename</kbd>\n\n```python\n>>> fs.touch(\"anyfile.mp3\")\n{'name': 'anyfile.mp3',\n 'is_directory': False,\n 'size': 0,\n 'id': 2793077925249810265,\n 'parent_id': 0,\n 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',\n 'etime': datetime.datetime(2023, 12, 19, 17, 7, 15),\n 'utime': datetime.datetime(2023, 12, 19, 17, 7, 15),\n 'ptime': datetime.datetime(2023, 12, 19, 17, 7, 15),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'pick_code': 'd47r0th5u0sfhx50u',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 17, 7, 15, 197968),\n 'path': '/anyfile.mp3'}\n>>> fs.rename(\"anyfile.mp3\", \"xyz.mp4\")\n{'name': 'xyz.mp4',\n 'is_directory': False,\n 'size': 0,\n 'id': 2793078164048314194,\n 'parent_id': 0,\n 'sha1': 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709',\n 'etime': datetime.datetime(2023, 12, 19, 17, 7, 43),\n 'utime': datetime.datetime(2023, 12, 19, 17, 7, 43),\n 'ptime': datetime.datetime(2023, 12, 19, 17, 7, 43),\n 'open_time': datetime.datetime(1970, 1, 1, 8, 0),\n 'pick_code': 'e0bgvc5mdo6sxzlvx',\n 'star': False,\n 'lastest_update': datetime.datetime(2023, 12, 19, 17, 7, 43, 798793),\n 'path': '/xyz.mp4'}\n```\n\n**\u4f7f\u7528** <kbd>renames</kbd> **\u65b9\u6cd5\u53ef\u4ee5\u5bf9\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u8fdb\u884c\u6539\u540d\u6216\u79fb\u52a8\uff0c\u5e76\u4e14\u5728\u79fb\u52a8\u540e\u5982\u679c\u539f\u6765\u6240\u5728\u76ee\u5f55\u4e3a\u7a7a\uff0c\u5219\u4f1a\u5220\u9664\u90a3\u4e2a\u76ee\u5f55\uff0c\u53c2\u8003** <kbd>os.renames</kbd>\n\n**\u4f7f\u7528** <kbd>replace</kbd> **\u65b9\u6cd5\u53ef\u4ee5\u5bf9\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u8fdb\u884c\u6539\u540d\u6216\u79fb\u52a8\uff0c\u5e76\u4e14\u5982\u679c\u539f\u59cb\u8def\u5f84\u4e0a\u662f\u6587\u4ef6\uff0c\u76ee\u6807\u8def\u5f84\u4e0a\u4e5f\u5b58\u5728\u4e00\u4e2a\u6587\u4ef6\uff0c\u5219\u4f1a\u5148\u628a\u76ee\u6807\u8def\u5f84\u4e0a\u7684\u6587\u4ef6\u5220\u9664\uff0c\u53c2\u8003** <kbd>os.replace</kbd>\n\n**\u4f7f\u7528** <kbd>move</kbd> **\u65b9\u6cd5\u53ef\u4ee5\u5bf9\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u8fdb\u884c\u6539\u540d\u6216\u79fb\u52a8\uff0c\u76ee\u6807\u8def\u5f84\u5b58\u5728\u4e14\u662f\u4e00\u4e2a\u76ee\u5f55\uff0c\u5219\u628a\u6587\u4ef6\u79fb\u52a8\u5230\u5176\u4e2d\uff08\u4f46\u662f\u76ee\u5f55\u4e2d\u6709\u540c\u540d\u7684\u6587\u4ef6\u6216\u6587\u4ef6\u5939\uff0c\u8fd8\u662f\u4f1a\u62a5\u9519\uff09\uff0c\u53c2\u8003** <kbd>shutil.move</kbd>\n\n### 3. \u904d\u5386\u6587\u4ef6\u7cfb\u7edf\u548c\u67e5\u627e\u6587\u4ef6\n\n#### 1. \u83b7\u53d6\u5f53\u524d\u76ee\u5f55\u4e0b\u6240\u6709 .mkv \u6587\u4ef6\u7684 url\n\n**\u7b2c 1 \u79cd\u65b9\u6cd5\uff0c\u4f7f\u7528** <kbd>iter</kbd>\uff0c\u8fd4\u56de <kbd>P115Path</kbd> \u5bf9\u8c61\u7684\u8fed\u4ee3\u5668\n\n```python\nfor path in fs.iter(max_depth=-1):\n    if path.name.endswith(\".mkv\"):\n        print(path.url)\n```\n\n**\u7b2c 2 \u79cd\u65b9\u6cd5\uff0c\u4f7f\u7528** <kbd>glob</kbd>\uff0c\u53c2\u8003 <kbd>pathlib.Path.glob</kbd> \u548c <kbd>glob.iglob</kbd>\uff0c\u4f7f\u7528\u901a\u914d\u7b26\u67e5\u627e\n\n```python\nfor path in fs.glob(\"**/*.mkv\"):\n    print(path.url)\n```\n\n**\u7b2c 3 \u79cd\u65b9\u6cd5\uff0c\u4f7f\u7528** <kbd>rglob</kbd>\uff0c\u53c2\u8003 <kbd>pathlib.Path.rglob</kbd>\n\n```python\nfor path in fs.rglob(\"*.mkv\"):\n    print(path.url)\n```\n\n### 4. \u9488\u5bf9\u5206\u4eab\u94fe\u63a5\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\n\n<kbd>p115.P115ShareFileSystem</kbd> \u5b9e\u73b0\u4e86\u5728<kbd>\u5206\u4eab\u94fe\u63a5</kbd>\u4e0a\uff0c\u53ea\u8bfb\u7684\u6587\u4ef6\u7cfb\u7edf\u65b9\u6cd5\n\n<kbd>p115.P115SharePath</kbd> \u5b9e\u73b0\u4e86\u4e8c\u6b21\u5c01\u88c5\uff0c\u4ece\u8def\u5f84\u7684\u89d2\u5ea6\u6765\u8fdb\u884c\u64cd\u4f5c\n\n**\u521b\u5efa\u5b9e\u4f8b\u5bf9\u8c61**\n\n```python\nfrom p115 import P115ShareFileSystem\n\nshare_link = \"https://115.com/s/swzn4d53w8m?password=f247#\"\n\nshare_fs = P115ShareFileSystem(client, share_link)\n```\n\n\u6216\u8005\u76f4\u63a5\u5728 <kbd>client</kbd> \u4e0a\u5c31\u53ef\u83b7\u53d6\n\n```python\nshare_fs = client.get_share_fs(share_link)\n```\n\n### 5. \u9488\u5bf9\u538b\u7f29\u6587\u4ef6\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\n\n<kbd>p115.P115ZipFileSystem</kbd> \u5b9e\u73b0\u4e86\u5728<kbd>\u538b\u7f29\u5305</kbd>\u4e0a\uff0c\u53ea\u8bfb\u7684\u6587\u4ef6\u7cfb\u7edf\u65b9\u6cd5\n\n<kbd>p115.P115ZipPath</kbd> \u5b9e\u73b0\u4e86\u4e8c\u6b21\u5c01\u88c5\uff0c\u4ece\u8def\u5f84\u7684\u89d2\u5ea6\u6765\u8fdb\u884c\u64cd\u4f5c\n\n**\u521b\u5efa\u5b9e\u4f8b\u5bf9\u8c61**\n\n```python\nfrom p115 import P115ZipFileSystem\n\npick_code = \"abcdefg\"\n\nzip_fs = P115ZipFileSystem(client, pick_code)\n```\n\n\u6216\u8005\u76f4\u63a5\u5728 <kbd>client</kbd> \u4e0a\u5c31\u53ef\u83b7\u53d6\n\n```python\nzip_fs = client.get_zip_fs(pick_code)\n```\n\n### 6. \u9488\u5bf9\u4e91\u4e0b\u8f7d\u7684\u5c01\u88c5\n\n<kbd>p115.P115Offline</kbd> \u5b9e\u73b0\u4e86\u5bf9\u4e8e<kbd>\u4e91\u4e0b\u8f7d</kbd>\u7684\u5c01\u88c5\u3002\n\n**\u521b\u5efa\u5b9e\u4f8b\u5bf9\u8c61**\n\n```python\nfrom p115 import P115Offline\n\noffline = P115Offline(client)\n```\n\n\u6216\u8005\u76f4\u63a5\u5728 <kbd>client</kbd> \u4e0a\u5c31\u53ef\u83b7\u53d6\n\n```python\noffline = client.offline\n```\n\n### 7. \u9488\u5bf9\u56de\u6536\u7ad9\u7684\u5c01\u88c5\n\n<kbd>p115.P115Recyclebin</kbd> \u5b9e\u73b0\u4e86\u5bf9\u4e8e<kbd>\u56de\u6536\u7ad9</kbd>\u7684\u5c01\u88c5\u3002\n\n**\u521b\u5efa\u5b9e\u4f8b\u5bf9\u8c61**\n\n```python\nfrom p115 import P115Recyclebin\n\nrecyclebin = P115Recyclebin(client)\n```\n\n\u6216\u8005\u76f4\u63a5\u5728 <kbd>client</kbd> \u4e0a\u5c31\u53ef\u83b7\u53d6\n\n```python\nrecyclebin = client.recyclebin\n```\n\n### 8. \u9488\u5bf9\u5206\u4eab\u7684\u5c01\u88c5\n\n<kbd>p115.P115Sharing</kbd> \u5b9e\u73b0\u4e86\u5bf9\u4e8e<kbd>\u5206\u4eab\u8bb0\u5f55</kbd>\u7684\u5c01\u88c5\u3002\n\n**\u521b\u5efa\u5b9e\u4f8b\u5bf9\u8c61**\n\n```python\nfrom p115 import P115Sharing\n\nsharing = P115Sharing(client)\n```\n\n\u6216\u8005\u76f4\u63a5\u5728 <kbd>client</kbd> \u4e0a\u5c31\u53ef\u83b7\u53d6\n\n```python\nsharing = client.sharing\n```\n\n## \u6587\u6863\n\n> \u6b63\u5728\u7f16\u5199\u4e2d\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for 115 webdisk.",
    "version": "0.0.5.11",
    "project_urls": {
        "Homepage": "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-115-client",
        "Repository": "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-115-client"
    },
    "split_keywords": [
        "nas",
        " 115"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aaa83b1bda174473074f9c9efcd7c5acc7f9b14c6f4d9e63d247880306450d73",
                "md5": "a7491c898f36b6302b7f4157f298d0cb",
                "sha256": "ac23099ddc6366212abfb7836229df107a84aea647db000a6259c2bd7839a3d4"
            },
            "downloads": -1,
            "filename": "python_115-0.0.5.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a7491c898f36b6302b7f4157f298d0cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 82706,
            "upload_time": "2024-04-12T09:41:44",
            "upload_time_iso_8601": "2024-04-12T09:41:44.827227Z",
            "url": "https://files.pythonhosted.org/packages/aa/a8/3b1bda174473074f9c9efcd7c5acc7f9b14c6f4d9e63d247880306450d73/python_115-0.0.5.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3108b4b3f08649e7d451730dd9c5aadc4bf81a46d03f1949271eadf6d7e97a3d",
                "md5": "aa29cd3ef8c340d71d0f0a0d2e7d9bcc",
                "sha256": "a5bb1a310979bf78fffe2e1249af3ac9196ea53b152f2a8aedc574d0c5205a56"
            },
            "downloads": -1,
            "filename": "python_115-0.0.5.11.tar.gz",
            "has_sig": false,
            "md5_digest": "aa29cd3ef8c340d71d0f0a0d2e7d9bcc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 80069,
            "upload_time": "2024-04-12T09:41:48",
            "upload_time_iso_8601": "2024-04-12T09:41:48.819054Z",
            "url": "https://files.pythonhosted.org/packages/31/08/b4b3f08649e7d451730dd9c5aadc4bf81a46d03f1949271eadf6d7e97a3d/python_115-0.0.5.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-12 09:41:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ChenyangGao",
    "github_project": "web-mount-packs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-115"
}
        
Elapsed time: 0.32621s