Pathy storage for fake.py
Project description
fake-py-pathy-storage is a Pathy storage integration for fake.py - a standalone, portable library designed for generating various random data types for testing.
Features
Cloud storages integration includes support for AWS S3, Google Cloud Storage and Azure Cloud Storage.
Prerequisites
Python 3.9+
Installation
pip install fake-py-pathy-storage
Documentation
Documentation is available on Read the Docs.
For guidelines on contributing check the Contributor guidelines.
Usage
Local cloud-alike file system 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)
Tests
pytest
Writing documentation
Keep the following hierarchy.
=====
title
=====
header
======
sub-header
----------
sub-sub-header
~~~~~~~~~~~~~~
sub-sub-sub-header
^^^^^^^^^^^^^^^^^^
sub-sub-sub-sub-header
++++++++++++++++++++++
sub-sub-sub-sub-sub-header
**************************
License
MIT
Support
For security issues contact me at the e-mail given in the Author section.
For overall issues, go to GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for fake_py_pathy_storage-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ff1b16f4fa3a587f78a442dc899f2d2a20bb9da219b2c2c302000ed6e2cfb8d |
|
MD5 | 3d21ce748ac21c36d7004c685a781230 |
|
BLAKE2b-256 | 4fdeb7b62c10978ca505510aaec675e667ec1f4efc8b8dc6609ca827cc7d6430 |
Close
Hashes for fake_py_pathy_storage-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 349beb4882078b472f5aa76d69e061c1360d71fb43f0b7c4a7490d195e1e983f |
|
MD5 | 53975db6c2bee09b765cf8fbce52a99d |
|
BLAKE2b-256 | 9374ff7e780c134a4f66f62f241de6e94062a4d11e7c0b7083a521fa5d8b12cd |