momento


Namemomento JSON
Version 1.20.1 PyPI version JSON
download
home_pagehttps://gomomento.com
SummarySDK for Momento
upload_time2024-03-20 18:20:51
maintainerNone
docs_urlNone
authorMomento
requires_python<4.0,>=3.7
licenseApache-2.0
keywords momento caching key-value store serverless
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <head>
  <meta name="Momento Python Client Library Documentation" content="Python client software development kit for Momento Cache">
</head>
<img src="https://docs.momentohq.com/img/momento-logo-forest.svg" alt="logo" width="400"/>

[![project status](https://momentohq.github.io/standards-and-practices/badges/project-status-official.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)
[![project stability](https://momentohq.github.io/standards-and-practices/badges/project-stability-stable.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)

# Momento Python Client Library

Momento Cache is a fast, simple, pay-as-you-go caching solution without any of the operational overhead
required by traditional caching solutions.  This repo contains the source code for the Momento Python client library.

To get started with Momento you will need a Momento Auth Token. You can get one from the [Momento Console](https://console.gomomento.com).

* Website: [https://www.gomomento.com/](https://www.gomomento.com/)
* Momento Documentation: [https://docs.momentohq.com/](https://docs.momentohq.com/)
* Getting Started: [https://docs.momentohq.com/getting-started](https://docs.momentohq.com/getting-started)
* Python SDK Documentation: [https://docs.momentohq.com/develop/sdks/python](https://docs.momentohq.com/develop/sdks/python)
* Discuss: [Momento Discord](https://discord.gg/3HkAKjUZGq)

## Packages

The Momento Python SDK package is available on pypi: [momento](https://pypi.org/project/momento/).

## Usage

The examples below require an environment variable named `MOMENTO_API_KEY` which must
be set to a valid Momento API key. You can get one from the [Momento Console](https://console.gomomento.com).

Python 3.10 introduced the `match` statement, which allows for [structural pattern matching on objects](https://peps.python.org/pep-0636/#adding-a-ui-matching-objects).
If you are running python 3.10 or greater, here is a quickstart you can use in your own project:

```python
from datetime import timedelta

from momento import CacheClient, Configurations, CredentialProvider
from momento.responses import CacheGet

cache_client = CacheClient(
    Configurations.Laptop.v1(), CredentialProvider.from_environment_variable("MOMENTO_API_KEY"), timedelta(seconds=60)
)

cache_client.create_cache("cache")
cache_client.set("cache", "my-key", "my-value")
get_response = cache_client.get("cache", "my-key")
match get_response:
    case CacheGet.Hit() as hit:
        print(f"Got value: {hit.value_string}")
    case _:
        print(f"Response was not a hit: {get_response}")

```

The above code uses [structural pattern matching](https://peps.python.org/pep-0636/), a feature introduced in Python 3.10.
Using a Python version less than 3.10? No problem. Here is the same example compatible across all versions of Python:

```python
from datetime import timedelta

from momento import CacheClient, Configurations, CredentialProvider
from momento.responses import CacheGet

cache_client = CacheClient(
    configuration=Configurations.Laptop.v1(),
    credential_provider=CredentialProvider.from_environment_variable("MOMENTO_API_KEY"),
    default_ttl=timedelta(seconds=60),
)
cache_client.create_cache("cache")
cache_client.set("cache", "myKey", "myValue")
get_response = cache_client.get("cache", "myKey")
if isinstance(get_response, CacheGet.Hit):
    print(f"Got value: {get_response.value_string}")

```

## Getting Started and Documentation

Documentation is available on the [Momento Docs website](https://docs.momentohq.com).

## Examples

Working example projects, with all required build configuration files, are available for both Python 3.10 and up
and Python versions before 3.10:

* [Python 3.10+ examples](./examples/py310)
* [Pre-3.10 Python examples](./examples/prepy310)

## Developing

If you are interested in contributing to the SDK, please see the [CONTRIBUTING](./CONTRIBUTING.md) docs.

----------------------------------------------------------------------------------------
For more info, visit our website at [https://gomomento.com](https://gomomento.com)!

            

Raw data

            {
    "_id": null,
    "home_page": "https://gomomento.com",
    "name": "momento",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.7",
    "maintainer_email": null,
    "keywords": "Momento, caching, key-value store, serverless",
    "author": "Momento",
    "author_email": "hello@momentohq.com",
    "download_url": "https://files.pythonhosted.org/packages/3f/5d/30519f8960ed2e296389d01bb58bc5aa5fcbde517e1e99f6362e77e56ef6/momento-1.20.1.tar.gz",
    "platform": null,
    "description": "<head>\n  <meta name=\"Momento Python Client Library Documentation\" content=\"Python client software development kit for Momento Cache\">\n</head>\n<img src=\"https://docs.momentohq.com/img/momento-logo-forest.svg\" alt=\"logo\" width=\"400\"/>\n\n[![project status](https://momentohq.github.io/standards-and-practices/badges/project-status-official.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)\n[![project stability](https://momentohq.github.io/standards-and-practices/badges/project-stability-stable.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)\n\n# Momento Python Client Library\n\nMomento Cache is a fast, simple, pay-as-you-go caching solution without any of the operational overhead\nrequired by traditional caching solutions.  This repo contains the source code for the Momento Python client library.\n\nTo get started with Momento you will need a Momento Auth Token. You can get one from the [Momento Console](https://console.gomomento.com).\n\n* Website: [https://www.gomomento.com/](https://www.gomomento.com/)\n* Momento Documentation: [https://docs.momentohq.com/](https://docs.momentohq.com/)\n* Getting Started: [https://docs.momentohq.com/getting-started](https://docs.momentohq.com/getting-started)\n* Python SDK Documentation: [https://docs.momentohq.com/develop/sdks/python](https://docs.momentohq.com/develop/sdks/python)\n* Discuss: [Momento Discord](https://discord.gg/3HkAKjUZGq)\n\n## Packages\n\nThe Momento Python SDK package is available on pypi: [momento](https://pypi.org/project/momento/).\n\n## Usage\n\nThe examples below require an environment variable named `MOMENTO_API_KEY` which must\nbe set to a valid Momento API key. You can get one from the [Momento Console](https://console.gomomento.com).\n\nPython 3.10 introduced the `match` statement, which allows for [structural pattern matching on objects](https://peps.python.org/pep-0636/#adding-a-ui-matching-objects).\nIf you are running python 3.10 or greater, here is a quickstart you can use in your own project:\n\n```python\nfrom datetime import timedelta\n\nfrom momento import CacheClient, Configurations, CredentialProvider\nfrom momento.responses import CacheGet\n\ncache_client = CacheClient(\n    Configurations.Laptop.v1(), CredentialProvider.from_environment_variable(\"MOMENTO_API_KEY\"), timedelta(seconds=60)\n)\n\ncache_client.create_cache(\"cache\")\ncache_client.set(\"cache\", \"my-key\", \"my-value\")\nget_response = cache_client.get(\"cache\", \"my-key\")\nmatch get_response:\n    case CacheGet.Hit() as hit:\n        print(f\"Got value: {hit.value_string}\")\n    case _:\n        print(f\"Response was not a hit: {get_response}\")\n\n```\n\nThe above code uses [structural pattern matching](https://peps.python.org/pep-0636/), a feature introduced in Python 3.10.\nUsing a Python version less than 3.10? No problem. Here is the same example compatible across all versions of Python:\n\n```python\nfrom datetime import timedelta\n\nfrom momento import CacheClient, Configurations, CredentialProvider\nfrom momento.responses import CacheGet\n\ncache_client = CacheClient(\n    configuration=Configurations.Laptop.v1(),\n    credential_provider=CredentialProvider.from_environment_variable(\"MOMENTO_API_KEY\"),\n    default_ttl=timedelta(seconds=60),\n)\ncache_client.create_cache(\"cache\")\ncache_client.set(\"cache\", \"myKey\", \"myValue\")\nget_response = cache_client.get(\"cache\", \"myKey\")\nif isinstance(get_response, CacheGet.Hit):\n    print(f\"Got value: {get_response.value_string}\")\n\n```\n\n## Getting Started and Documentation\n\nDocumentation is available on the [Momento Docs website](https://docs.momentohq.com).\n\n## Examples\n\nWorking example projects, with all required build configuration files, are available for both Python 3.10 and up\nand Python versions before 3.10:\n\n* [Python 3.10+ examples](./examples/py310)\n* [Pre-3.10 Python examples](./examples/prepy310)\n\n## Developing\n\nIf you are interested in contributing to the SDK, please see the [CONTRIBUTING](./CONTRIBUTING.md) docs.\n\n----------------------------------------------------------------------------------------\nFor more info, visit our website at [https://gomomento.com](https://gomomento.com)!\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "SDK for Momento",
    "version": "1.20.1",
    "project_urls": {
        "Documentation": "https://docs.momentohq.com/",
        "Homepage": "https://gomomento.com",
        "Repository": "https://github.com/momentohq/client-sdk-python"
    },
    "split_keywords": [
        "momento",
        " caching",
        " key-value store",
        " serverless"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5509ad75d4f4b25c34618066188d577f597d65786d0c260af50829617f121d64",
                "md5": "b839fa24cadfc95d10c70833541b7a14",
                "sha256": "453b2f1629f866d1ebec731894516368412ad8be8155f0b3ff890d497dda3520"
            },
            "downloads": -1,
            "filename": "momento-1.20.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b839fa24cadfc95d10c70833541b7a14",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 151415,
            "upload_time": "2024-03-20T18:20:48",
            "upload_time_iso_8601": "2024-03-20T18:20:48.491418Z",
            "url": "https://files.pythonhosted.org/packages/55/09/ad75d4f4b25c34618066188d577f597d65786d0c260af50829617f121d64/momento-1.20.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f5d30519f8960ed2e296389d01bb58bc5aa5fcbde517e1e99f6362e77e56ef6",
                "md5": "9e8a62c2b0efd419b55210f5a2898877",
                "sha256": "756cd0bd15fabb7b1bebab5e704622f2aeecc5a6029c03b956b51644f30b7820"
            },
            "downloads": -1,
            "filename": "momento-1.20.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9e8a62c2b0efd419b55210f5a2898877",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 88630,
            "upload_time": "2024-03-20T18:20:51",
            "upload_time_iso_8601": "2024-03-20T18:20:51.811463Z",
            "url": "https://files.pythonhosted.org/packages/3f/5d/30519f8960ed2e296389d01bb58bc5aa5fcbde517e1e99f6362e77e56ef6/momento-1.20.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-20 18:20:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "momentohq",
    "github_project": "client-sdk-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "momento"
}
        
Elapsed time: 0.21044s