# Fdfs_client py
The Python interface to the Fastdfs Ver 4.06.
## Installation
$ sudo python setup.py install
## Getting Started
1. import fdfs_client.client module
2. instantiate class Fdfs_client
3. call memeber functions
>>> from fdfs_client.client import *
>>> client = Fdfs_client('/etc/fdfs/client.conf')
>>> ret = client.upload_by_filename('test')
>>> ret
{'Group name':'group1','Status':'Upload successed.', 'Remote file_id':'group1/M00/00/00/
wKjzh0_xaR63RExnAAAaDqbNk5E1398.py','Uploaded size':'6.0KB','Local file name':'test'
, 'Storage IP':'192.168.243.133'}
## API Reference
Class Fdfs_client:
member functions:
* upload_by_filename(self, filename, meta_dict = None)
'''
Upload a file to Storage server.
arguments:
@filename: string, name of file that will be uploaded
@meta_dict: dictionary e.g.:{
'ext_name' : 'jpg',
'file_size' : '10240B',
'width' : '160px',
'hight' : '80px'
} meta_dict can be null
@return dict {
'Group name' : group_name,
'Remote file_id' : remote_file_id,
'Status' : 'Upload successed.',
'Local file name' : local_file_name,
'Uploaded size' : upload_size,
'Storage IP' : storage_ip
} if success else None
* upload_by_buffer(self, filebuffer, file_ext_name = None, meta_dict = None)
'''
Upload a buffer to Storage server.
arguments:
@filebuffer: string, buffer
@file_ext_name: string, file extend name
@meta_dict: dictionary e.g.:{
'ext_name' : 'jpg',
'file_size' : '10240B',
'width' : '160px',
'hight' : '80px'
}
@return dict {
'Group name' : group_name,
'Remote file_id' : remote_file_id,
'Status' : 'Upload successed.',
'Local file name' : '',
'Uploaded size' : upload_size,
'Storage IP' : storage_ip
}
'''
* upload_slave_by_filename(self, filename, remote_file_id, prefix_name, \
meta_dict = None)
'''
Upload slave file to Storage server.
arguments:
@filename: string, local file name
@remote_file_id: string, remote file id
@prefix_name: string
@meta_dict: dictionary e.g.:{
'ext_name' : 'jpg',
'file_size' : '10240B',
'width' : '160px',
'hight' : '80px'
}
@return dictionary {
'Status' : 'Upload slave successed.',
'Local file name' : local_filename,
'Uploaded size' : upload_size,
'Remote file id' : remote_file_id,
'Storage IP' : storage_ip
}
'''
* upload_slave_by_buffer(self, filebuffer, remote_file_id, \
meta_dict = None, file_ext_name = None)
'''
Upload slave file by buffer
arguments:
@filebuffer: string
@remote_file_id: string
@meta_dict: dictionary e.g.:{
'ext_name' : 'jpg',
'file_size' : '10240B',
'width' : '160px',
'hight' : '80px'
}
@return dictionary {
'Status' : 'Upload slave successed.',
'Local file name' : local_filename,
'Uploaded size' : upload_size,
'Remote file id' : remote_file_id,
'Storage IP' : storage_ip
}
'''
* upload_appender_by_filename(self, local_filename, meta_dict = None)
'''
Upload an appender file by filename.
arguments:
@local_filename: string
@meta_dict: dictionary e.g.:{
'ext_name' : 'jpg',
'file_size' : '10240B',
'width' : '160px',
'hight' : '80px'
} Notice: it can be null
@return dict {
'Group name' : group_name,
'Remote file_id' : remote_file_id,
'Status' : 'Upload successed.',
'Local file name' : '',
'Uploaded size' : upload_size,
'Storage IP' : storage_ip
}
'''
* upload_appender_by_buffer(self, filebuffer, file_ext_name = None, meta_dict = None)
'''
Upload a buffer to Storage server.
arguments:
@filebuffer: string
@file_ext_name: string, can be null
@meta_dict: dictionary, can be null
@return dict {
'Group name' : group_name,
'Remote file_id' : remote_file_id,
'Status' : 'Upload successed.',
'Local file name' : '',
'Uploaded size' : upload_size,
'Storage IP' : storage_ip
}
'''
* delete_file(self, remote_file_id)
'''
Delete a file from Storage server.
arguments:
@remote_file_id: string, file_id of file that is on storage server
@return tuple ('Delete file successed.', remote_file_id, storage_ip)
'''
* download_to_file(self, local_filename, remote_file_id, offset = 0, down_bytes = 0)
'''
Download a file from Storage server.
arguments:
@local_filename: string, local name of file
@remote_file_id: string, file_id of file that is on storage server
@offset: long
@down_bytes: long
@return dict {
'Remote file_id' : remote_file_id,
'Content' : local_filename,
'Download size' : downloaded_size,
'Storage IP' : storage_ip
}
'''
* download_to_buffer(self, remote_file_id, offset = 0, down_bytes = 0)
'''
Download a file from Storage server and store in buffer.
arguments:
@remote_file_id: string, file_id of file that is on storage server
@offset: long
@down_bytes: long
@return dict {
'Remote file_id' : remote_file_id,
'Content' : file_buffer,
'Download size' : downloaded_size,
'Storage IP' : storage_ip
}
'''
* list_one_group(self, group_name)
'''
List one group information.
arguments:
@group_name: string, group name will be list
@return Group_info, instance
'''
* list_all_groups(self)
'''
List all group information.
@return dictionary {
'Groups count' : group_count,
'Groups' : list of groups
}
'''
* list_servers(self, group_name, storage_ip = None)
'''
List all storage servers information in a group
arguments:
@group_name: string
@return dictionary {
'Group name' : group_name,
'Servers' : server list,
}
'''
* get_meta_data(self, remote_file_id)
'''
Get meta data of remote file.
arguments:
@remote_fileid: string, remote file id
@return dictionary, meta data
'''
* set_meta_data(self, remote_file_id, \
meta_dict, op_flag = STORAGE_SET_METADATA_FLAG_OVERWRITE)
'''
Set meta data of remote file.
arguments:
@remote_file_id: string
@meta_dict: dictionary
@op_flag: char, 'O' for overwrite, 'M' for merge
@return dictionary {
'Status' : status,
'Storage IP' : storage_ip
}
'''
* append_by_filename(self, local_filename, remote_fileid)
'''
Append a file of Storage server
arguments:
@local_filename: string
@remote_fileid: string
@return dict {
'Group name' : group_name,
'Remote file_id' : remote_file_id,
'Status' : 'Upload successed.',
'Local file name' : '',
'Uploaded size' : upload_size,
'Storage IP' : storage_ip
}
'''
* append_by_buffer(self, file_buffer, remote_fileid)
'''
Append a file of Storage server
arguments:
@file_buffer: string
@remote_fileid: string
@return dict {
'Group name' : group_name,
'Remote file_id' : remote_file_id,
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于Django+python开发的B2C分布式生鲜商城源码-毕设项目.zip 【说明】 技术栈 语言:Python3.6.8 (Django==2.1.5) 数据库: MySql、 redis 任务队列(异步处理): celery 分布式文件存储: FastDFS 搜索引擎(商品检索): django-haystack 、whoosh web服务器配置: Nginx+ uwsgi 后台管理: django-xadmin 安装和配置 安装python3.6 安装依赖包 安装PIP安装FASTDFS可能会有异常 进入项目根目录提供的requirement文件夹,进入fdfs_client-py-master python setup.py install等待安装完毕即可 安装xadmin 找到xadmin的压缩包pip install xadmin-django2.zip' 进入项目根目录pip install -r requeirtments.txt 配置数据库 setting文件配置好mysql数据库 填入REDIS_CONFIG的配置信息 生成迁移文件 python manager
资源推荐
资源详情
资源评论
收起资源包目录
基于Django+python开发的B2C分布式生鲜商城源码-毕设项目+项目说明.zip (2000个子文件)
sendfilemodule.c 11KB
setup.cfg 59B
CHANGES 1KB
main.css 22KB
main.css 22KB
responsive.css 18KB
select2.css 17KB
base.css 16KB
ui.css 15KB
select2.min.css 15KB
ui.css 15KB
widgets.css 10KB
ui.css 9KB
forms.css 8KB
autocomplete.css 8KB
window.css 6KB
changelists.css 6KB
dialog.css 6KB
dialog.css 6KB
dialog.css 5KB
rtl.css 4KB
visualblocks.css 3KB
content.css 2KB
ui.css 2KB
content.css 2KB
ui.css 2KB
fullpage.css 2KB
responsive_rtl.css 2KB
ui_black.css 2KB
media.css 1KB
login.css 1KB
content.css 1KB
props.css 892B
ui_silver.css 855B
advimage.css 659B
reset.css 638B
reset.css 638B
popup.css 505B
content.css 488B
advlink.css 472B
content.css 444B
fonts.css 423B
dashboard.css 412B
row.css 281B
template.css 252B
advhr.css 235B
cell.css 189B
attributes.css 186B
searchreplace.css 170B
table.css 157B
content.css 97B
icons.gif 12KB
progress.gif 2KB
sample.gif 2KB
tabs.gif 1KB
buttons.gif 1KB
corners.gif 909B
confirm.gif 907B
alert.gif 810B
icons.gif 806B
horizontal.gif 769B
iframe.gif 600B
video.gif 597B
realmedia.gif 439B
windowsmedia.gif 415B
shockwave.gif 384B
smiley-cool.gif 354B
smiley-wink.gif 350B
smiley-smile.gif 344B
smiley-laughing.gif 343B
smiley-foot-in-mouth.gif 342B
smiley-frown.gif 340B
smiley-kiss.gif 338B
smiley-surprised.gif 338B
smiley-undecided.gif 337B
smiley-innocent.gif 336B
smiley-yell.gif 336B
smiley-embarassed.gif 331B
smiley-cry.gif 329B
smiley-tongue-out.gif 328B
pagebreak.gif 325B
smiley-sealed.gif 323B
smiley-money-mouth.gif 321B
quicktime.gif 301B
button.gif 272B
flash.gif 239B
example.gif 87B
vertical.gif 84B
menu_check.gif 70B
menu_arrow.gif 68B
items.gif 64B
wline.gif 46B
trans.gif 43B
.gitignore 783B
media.htm 37KB
props.htm 37KB
link.htm 15KB
template.htm 12KB
image.htm 12KB
fullpage.htm 10KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
onnx
- 粉丝: 9619
- 资源: 5597
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功