fake.py的Pathy存储
项目描述
fake-py-pathy-storage 是 Pathy storage integration for fake.py - 一个独立的、便携的库,旨在为测试生成各种随机数据类型。
特性
云存储集成包括对AWS S3、Google Cloud Storage和Azure Cloud Storage的支持。
先决条件
Python 3.9+
安装
pip install fake-py-pathy-storage
文档
文档可在 Read the Docs 上找到。
有关贡献指南,请查看 贡献指南。
使用方法
本地类似云的文件系统存储
from fake import FAKER
from fakepy.pathy_storage.cloud import PathyFileSystemStorage
STORAGE = PathyFileSystemStorage(
bucket_name="bucket_name",
root_path="tmp", # Optional
rel_path="sub-tmp", # Optional
)
pdf_file = FAKER.pdf_file(storage=STORAGE)
STORAGE.exists(pdf_file)
AWS S3
from fake import FAKER
from fakepy.pathy_storage.aws_s3 import AWSS3Storage
STORAGE = AWSS3Storage(
bucket_name="bucket_name",
root_path="tmp", # Optional
rel_path="sub-tmp", # Optional
# Credentials are optional too. If your AWS credentials are properly
# set in the ~/.aws/credentials, you don't need to send them
# explicitly.
credentials={
"key_id": "YOUR KEY ID",
"key_secret": "YOUR KEY SECRET"
},
)
pdf_file = FAKER.pdf_file(storage=STORAGE)
STORAGE.exists(pdf_file)
Google Cloud Storage
from fake import FAKER
from fakepy.pathy_storage.google_cloud_storage import GoogleCloudStorage
STORAGE = GoogleCloudStorage(
bucket_name="bucket_name",
root_path="tmp", # Optional
rel_path="sub-tmp", # Optional
)
pdf_file = FAKER.pdf_file(storage=STORAGE)
STORAGE.exists(pdf_file)
Azure Cloud Storage
from fake import FAKER
from fakepy.pathy_storage.azure_cloud_storage import AzureCloudStorage
STORAGE = AzureCloudStorage(
bucket_name="bucket_name",
root_path="tmp", # Optional
rel_path="sub-tmp", # Optional
)
pdf_file = FAKER.pdf_file(storage=STORAGE)
STORAGE.exists(pdf_file)
测试
pytest
编写文档
保持以下层次结构。
=====
title
=====
header
======
sub-header
----------
sub-sub-header
~~~~~~~~~~~~~~
sub-sub-sub-header
^^^^^^^^^^^^^^^^^^
sub-sub-sub-sub-header
++++++++++++++++++++++
sub-sub-sub-sub-sub-header
**************************
许可证
MIT
支持
关于安全问题,请联系作者部分提供的邮箱。
关于总体问题,请访问GitHub。
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
fake_py_pathy_storage-0.1.1.tar.gz (26.4 kB 查看哈希值)
构建分发
关闭
哈希值 for fake_py_pathy_storage-0.1.1-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 349beb4882078b472f5aa76d69e061c1360d71fb43f0b7c4a7490d195e1e983f |
|
MD5 | 53975db6c2bee09b765cf8fbce52a99d |
|
BLAKE2b-256 | 9374ff7e780c134a4f66f62f241de6e94062a4d11e7c0b7083a521fa5d8b12cd |