awsfile-helper


Nameawsfile-helper JSON
Version 0.1.18 PyPI version JSON
download
home_pagehttps://github.com/craigtrim/awsfile-helper
SummaryAWS File Helper for Easier I/O
upload_time2023-07-26 19:40:29
maintainerCraig Trim
docs_urlNone
authorCraig Trim
requires_python>=3.8.5,<4.0.0
licenseNone
keywords aws cloud s3 bucket helper utility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AWS File Helper (awsfile-helper)
Content Management and Retrieval for Cloud and Local Storage

## Code Usage (Authorization)
You must have an AWS Access Key and Secret Access key to connect to AWS.

Upon obtaining these keys, use
```python
from baseblock import CryptoBase

os.environ['AWS_ACCESS_KEY'] = CryptoBase().encrypt_str('<my-access-key>')
os.environ['AWS_SECRET_KEY'] = CryptoBase().encrypt_str('<my-secret-key>')
```

This will place your encrypted credentials into the environment.

The `AwsAPI` class will retrieve and decrypt these credentials to login.

## Code Usage (General)
The following code will retrieve any file:
```python
from awsfile_helper import FindOwlFile

d_cloud_file = FindS3File(
    file_name='config/graphviz/stylesheets/nlu',
    file_ext='yaml', file_version='0.1.0').process()
```
The bucket is assumed to be `data-core-bast`.

We can modify this assumption down the road if we create new buckets for different clients, etc.

A file may also be retrieved without a version, like this:
```python
d_cloud_file = FindS3File(
    file_name='config/graphviz/stylesheets/nlu',
    file_ext='yaml').process()
```

In that case, the system will first look in the environment, using a key configuration that relies on the `file_name` like this: `CONFIG_GRAPHVIZ_STYLESHEETS_NLU_VERSION`.  If no value is found in the environment, the system will consider this a _wildcard_ match and set the version to `*`.  This forces the system to list the contents of the qualified path and choose the latest version.  This operation takes an additional 2-3 milliseconds, assuming the network is running smoothly.


## Code Usage (Ontologies)
Ontologies require a special finder class, because we typically have two files we want to retrieve - an OWL model and a TXT file with synonyms.

Therefore, assume that an S3 bucket exists with two files we want to retrieve: `syllabus.owl` and `syllabus.txt`.

The following code will retrieve these files:
```python
from awsfile_helper import FindOwlFile

d_cloud_file = FindOwlFile(file_name='syllabus', version='0.1.0').process()
```

Note that we did not specify the file extension within the `file_name` variable.

It is permissible to specify explicit file names such as `syllabus.txt` or partial file names such.

The result dictionary is keyed by file name and (with redacted contents) looks like this:
```json
{
    "owl": {
        "path": "<local path to OWL file">,
        "version": "<version of OWL file>",
        "contents": "<contents of OWL file>"
    },
    "txt": {
        "path": "<local path to txt file">,
        "version": "<version of txt file>",
        "contents": "<contents of txt file>"
    }
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/craigtrim/awsfile-helper",
    "name": "awsfile-helper",
    "maintainer": "Craig Trim",
    "docs_url": null,
    "requires_python": ">=3.8.5,<4.0.0",
    "maintainer_email": "craigtrim@gmail.com",
    "keywords": "aws,cloud,s3,bucket,helper,utility",
    "author": "Craig Trim",
    "author_email": "craigtrim@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/24/06/388c030cd900b2f8a431d73cefd55bd5221e4a4e0b8564d8d9618e299d02/awsfile_helper-0.1.18.tar.gz",
    "platform": null,
    "description": "# AWS File Helper (awsfile-helper)\nContent Management and Retrieval for Cloud and Local Storage\n\n## Code Usage (Authorization)\nYou must have an AWS Access Key and Secret Access key to connect to AWS.\n\nUpon obtaining these keys, use\n```python\nfrom baseblock import CryptoBase\n\nos.environ['AWS_ACCESS_KEY'] = CryptoBase().encrypt_str('<my-access-key>')\nos.environ['AWS_SECRET_KEY'] = CryptoBase().encrypt_str('<my-secret-key>')\n```\n\nThis will place your encrypted credentials into the environment.\n\nThe `AwsAPI` class will retrieve and decrypt these credentials to login.\n\n## Code Usage (General)\nThe following code will retrieve any file:\n```python\nfrom awsfile_helper import FindOwlFile\n\nd_cloud_file = FindS3File(\n    file_name='config/graphviz/stylesheets/nlu',\n    file_ext='yaml', file_version='0.1.0').process()\n```\nThe bucket is assumed to be `data-core-bast`.\n\nWe can modify this assumption down the road if we create new buckets for different clients, etc.\n\nA file may also be retrieved without a version, like this:\n```python\nd_cloud_file = FindS3File(\n    file_name='config/graphviz/stylesheets/nlu',\n    file_ext='yaml').process()\n```\n\nIn that case, the system will first look in the environment, using a key configuration that relies on the `file_name` like this: `CONFIG_GRAPHVIZ_STYLESHEETS_NLU_VERSION`.  If no value is found in the environment, the system will consider this a _wildcard_ match and set the version to `*`.  This forces the system to list the contents of the qualified path and choose the latest version.  This operation takes an additional 2-3 milliseconds, assuming the network is running smoothly.\n\n\n## Code Usage (Ontologies)\nOntologies require a special finder class, because we typically have two files we want to retrieve - an OWL model and a TXT file with synonyms.\n\nTherefore, assume that an S3 bucket exists with two files we want to retrieve: `syllabus.owl` and `syllabus.txt`.\n\nThe following code will retrieve these files:\n```python\nfrom awsfile_helper import FindOwlFile\n\nd_cloud_file = FindOwlFile(file_name='syllabus', version='0.1.0').process()\n```\n\nNote that we did not specify the file extension within the `file_name` variable.\n\nIt is permissible to specify explicit file names such as `syllabus.txt` or partial file names such.\n\nThe result dictionary is keyed by file name and (with redacted contents) looks like this:\n```json\n{\n    \"owl\": {\n        \"path\": \"<local path to OWL file\">,\n        \"version\": \"<version of OWL file>\",\n        \"contents\": \"<contents of OWL file>\"\n    },\n    \"txt\": {\n        \"path\": \"<local path to txt file\">,\n        \"version\": \"<version of txt file>\",\n        \"contents\": \"<contents of txt file>\"\n    }\n}\n```\n",
    "bugtrack_url": null,
    "license": "None",
    "summary": "AWS File Helper for Easier I/O",
    "version": "0.1.18",
    "project_urls": {
        "Bug Tracker": "https://github.com/craigtrim/awsfile-helper/issues",
        "Homepage": "https://github.com/craigtrim/awsfile-helper",
        "Repository": "https://github.com/craigtrim/awsfile-helper"
    },
    "split_keywords": [
        "aws",
        "cloud",
        "s3",
        "bucket",
        "helper",
        "utility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18a083f6067eb02d435171f7af5f20d671867b93a14caead5d287eadcf17c6eb",
                "md5": "1b59fea739a227f6d1fa529d5edde1b8",
                "sha256": "04abdba6eddf0cd974aede8ff2f29f63ee155f94cdb38d2fae6889f11114b72a"
            },
            "downloads": -1,
            "filename": "awsfile_helper-0.1.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1b59fea739a227f6d1fa529d5edde1b8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.5,<4.0.0",
            "size": 24428,
            "upload_time": "2023-07-26T19:40:28",
            "upload_time_iso_8601": "2023-07-26T19:40:28.231734Z",
            "url": "https://files.pythonhosted.org/packages/18/a0/83f6067eb02d435171f7af5f20d671867b93a14caead5d287eadcf17c6eb/awsfile_helper-0.1.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2406388c030cd900b2f8a431d73cefd55bd5221e4a4e0b8564d8d9618e299d02",
                "md5": "1e86175b20d2f960e00a0f62a8359f85",
                "sha256": "4d558c05384157b5257e80a988017327fa2901bce3ce0a7c9ff05727fc0cdd75"
            },
            "downloads": -1,
            "filename": "awsfile_helper-0.1.18.tar.gz",
            "has_sig": false,
            "md5_digest": "1e86175b20d2f960e00a0f62a8359f85",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.5,<4.0.0",
            "size": 12798,
            "upload_time": "2023-07-26T19:40:29",
            "upload_time_iso_8601": "2023-07-26T19:40:29.758600Z",
            "url": "https://files.pythonhosted.org/packages/24/06/388c030cd900b2f8a431d73cefd55bd5221e4a4e0b8564d8d9618e299d02/awsfile_helper-0.1.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-26 19:40:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "craigtrim",
    "github_project": "awsfile-helper",
    "github_not_found": true,
    "lcname": "awsfile-helper"
}
        
Elapsed time: 0.11599s