跳转到主要内容

fake.py的Pathy存储

项目描述

Pathy storage for fake.py.

PyPI Version Supported Python versions Build Status Documentation Status MIT Coverage

fake-py-pathy-storagePathy storage integration for fake.py - 一个独立的、便携的库,旨在为测试生成各种随机数据类型。

特性

  • 云存储集成包括对AWS S3、Google Cloud Storage和Azure Cloud Storage的支持。

先决条件

Python 3.9+

安装

pip install fake-py-pathy-storage

文档

使用方法

本地类似云的文件系统存储

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

作者

Artur Barseghyan <artur.barseghyan@gmail.com>

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

fake_py_pathy_storage-0.1.1.tar.gz (26.4 kB 查看哈希值)

上传时间 源代码

构建分发

fake_py_pathy_storage-0.1.1-py3-none-any.whl (11.8 kB 查看哈希值)

上传时间 Python 3

由以下支持