buttercms-python


Namebuttercms-python JSON
Version 2.1.1 PyPI version JSON
download
home_pagehttps://github.com/buttercms/buttercms-python
SummaryAPI First Blogging and CMS platform built for developers
upload_time2024-05-07 15:37:44
maintainerNone
docs_urlNone
authorButterCMS
requires_pythonNone
licenseNone
keywords buttercms sdk cms api
VCS
bugtrack_url
requirements build certifi charset-normalizer idna packaging pyproject_hooks requests urllib3
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # buttercms-python - 2.1.1 <!-- {x-release-please-version} -->

Python Library for ButterCMS API. 

## Documentation

For a comprehensive list of examples, check out the [API documentation](https://buttercms.com/docs/api/).

## Jump to:

* [Pages](#pages)
* [Collections](#collections)
* [Posts](#posts)
* [Authors](#authors)
* [Categories](#categories)
* [Feeds](#feeds)

## Installation

Install from PyPi using [pip](http://www.pip-installer.org/en/latest/), a
package manager for Python.

    pip install buttercms-python


## Usage

Getting started with the ButterCMS API couldn't be easier. Use your authorization token to create a ButterCMS client.

```python
from butter_cms import ButterCMS

auth_token = "XXXXXXXXXXXXXXXXXXX"
client = ButterCMS(auth_token)
```

All methods return dictionaries. The data can be navigated using keys and indexes like the example below.

```python
response = client.posts.all()

posts = response['data'] 
# posts now contains a list of post dictionaries

my_post = posts[0]
# my_post contains the first returned post

print(my_post)
# {
#   "url": "http://www.example.com/blog/this-is-a-blog-post",
#   "created": "2015-06-12T13:59:32.441289Z",
#   "published": "2015-06-12T00:00:00Z",
#   ...
# }
```

### Pages

The Page's `.all()`, `.get()` and `.search()` methods accept an optional `params` to add additional data to the response.

```python
client.pages.all('news')

# Optional params
client.pages.all('news', {'foo': 'bar'})
```


```python
client.pages.get('news', 'hello-world')

# Optional params
client.pages.get('news', 'hello-world', {'foo': 'bar'})
```

```python
client.pages.search('enter search query', {'page': 1, 'page_size': 10})
```

[To Top](#buttercms-python)


### Collections

For a list of params see the [API documentation](https://buttercms.com/docs/api/?python#collections)

.get() method accepts an optional `params` dict to add additional data to the response.

```python
client.content_fields.get(['collection_key'], {'locale': 'en'})
```

[To Top](#buttercms-python)


### Blog Engine

#### Posts

```python
client.posts.all({'page_size': 3, 'page': 1, 'exclude_body': 'true'})
```


```python
client.posts.get('hello-world')
```


```python
client.posts.search('query', {'page': 1, 'page_size': 10})
```

#### Authors

The Author's `.all()` and `.get()` methods accept an optional `params` to add additional data to the response.

* `{'include':'recent_posts'}`: Adds each author's posts under the `recent_posts` key in that author's returned dictionary

```python
client.authors.all()
client.authors.all({'include':'recent_posts'})
```


```python
client.authors.get('jennifer-smith')
client.authors.get('jennifer-smith', {'include':'recent_posts'})
```


[To Top](#buttercms-python)

#### Categories

The Category's `.all()` and `.get()` methods accept an optional `params` to add additional data to the response.

* `{'include':'recent_posts'}`: Adds posts tagged with that category under the `recent_posts` key in that category's returned dictionary

```python
client.categories.all()
client.categories.all({'include':'recent_posts'})
```


```python
client.categories.get('product-updates')
client.categories.get('product-updates', {'include':'recent_posts'})
```


[To Top](#buttercms-python)


#### Tags

The Tag's `.all()` and `.get()` methods accept an optional `params` to add additional data to the response.

* `{'include':'recent_posts'}`: Adds posts tagged with that tag under the `recent_posts` key in that tag's returned dictionary

```python
client.tags.all()
client.tags.all({'include':'recent_posts'})
```


```python
client.tags.get('product-updates')
client.tags.get('product-updates', {'include':'recent_posts'})
```


[To Top](#buttercms-python)

#### Feeds

```python
client.feeds.get('rss')
```


```python
client.feeds.get('atom')
```


```python
client.feeds.get('sitemap')
```


[To Top](#buttercms-python)



### Other

View Python [Blog engine](https://buttercms.com/python-blog-engine/) and [Full CMS](https://buttercms.com/python-cms/) for other examples of using ButterCMS with Python.

### Tests

To run tests:

```python
python -m unittest butter_cms/unit_tests.py
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/buttercms/buttercms-python",
    "name": "buttercms-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "buttercms, sdk, cms, api",
    "author": "ButterCMS",
    "author_email": "support@buttercms.com",
    "download_url": "https://files.pythonhosted.org/packages/85/24/965b4d355952b6f7111b983afa656dde81978527b6c3f58b456a36fd7b31/buttercms_python-2.1.1.tar.gz",
    "platform": null,
    "description": "# buttercms-python - 2.1.1 <!-- {x-release-please-version} -->\n\nPython Library for ButterCMS API. \n\n## Documentation\n\nFor a comprehensive list of examples, check out the [API documentation](https://buttercms.com/docs/api/).\n\n## Jump to:\n\n* [Pages](#pages)\n* [Collections](#collections)\n* [Posts](#posts)\n* [Authors](#authors)\n* [Categories](#categories)\n* [Feeds](#feeds)\n\n## Installation\n\nInstall from PyPi using [pip](http://www.pip-installer.org/en/latest/), a\npackage manager for Python.\n\n    pip install buttercms-python\n\n\n## Usage\n\nGetting started with the ButterCMS API couldn't be easier. Use your authorization token to create a ButterCMS client.\n\n```python\nfrom butter_cms import ButterCMS\n\nauth_token = \"XXXXXXXXXXXXXXXXXXX\"\nclient = ButterCMS(auth_token)\n```\n\nAll methods return dictionaries. The data can be navigated using keys and indexes like the example below.\n\n```python\nresponse = client.posts.all()\n\nposts = response['data'] \n# posts now contains a list of post dictionaries\n\nmy_post = posts[0]\n# my_post contains the first returned post\n\nprint(my_post)\n# {\n#   \"url\": \"http://www.example.com/blog/this-is-a-blog-post\",\n#   \"created\": \"2015-06-12T13:59:32.441289Z\",\n#   \"published\": \"2015-06-12T00:00:00Z\",\n#   ...\n# }\n```\n\n### Pages\n\nThe Page's `.all()`, `.get()` and `.search()` methods accept an optional `params` to add additional data to the response.\n\n```python\nclient.pages.all('news')\n\n# Optional params\nclient.pages.all('news', {'foo': 'bar'})\n```\n\n\n```python\nclient.pages.get('news', 'hello-world')\n\n# Optional params\nclient.pages.get('news', 'hello-world', {'foo': 'bar'})\n```\n\n```python\nclient.pages.search('enter search query', {'page': 1, 'page_size': 10})\n```\n\n[To Top](#buttercms-python)\n\n\n### Collections\n\nFor a list of params see the [API documentation](https://buttercms.com/docs/api/?python#collections)\n\n.get() method accepts an optional `params` dict to add additional data to the response.\n\n```python\nclient.content_fields.get(['collection_key'], {'locale': 'en'})\n```\n\n[To Top](#buttercms-python)\n\n\n### Blog Engine\n\n#### Posts\n\n```python\nclient.posts.all({'page_size': 3, 'page': 1, 'exclude_body': 'true'})\n```\n\n\n```python\nclient.posts.get('hello-world')\n```\n\n\n```python\nclient.posts.search('query', {'page': 1, 'page_size': 10})\n```\n\n#### Authors\n\nThe Author's `.all()` and `.get()` methods accept an optional `params` to add additional data to the response.\n\n* `{'include':'recent_posts'}`: Adds each author's posts under the `recent_posts` key in that author's returned dictionary\n\n```python\nclient.authors.all()\nclient.authors.all({'include':'recent_posts'})\n```\n\n\n```python\nclient.authors.get('jennifer-smith')\nclient.authors.get('jennifer-smith', {'include':'recent_posts'})\n```\n\n\n[To Top](#buttercms-python)\n\n#### Categories\n\nThe Category's `.all()` and `.get()` methods accept an optional `params` to add additional data to the response.\n\n* `{'include':'recent_posts'}`: Adds posts tagged with that category under the `recent_posts` key in that category's returned dictionary\n\n```python\nclient.categories.all()\nclient.categories.all({'include':'recent_posts'})\n```\n\n\n```python\nclient.categories.get('product-updates')\nclient.categories.get('product-updates', {'include':'recent_posts'})\n```\n\n\n[To Top](#buttercms-python)\n\n\n#### Tags\n\nThe Tag's `.all()` and `.get()` methods accept an optional `params` to add additional data to the response.\n\n* `{'include':'recent_posts'}`: Adds posts tagged with that tag under the `recent_posts` key in that tag's returned dictionary\n\n```python\nclient.tags.all()\nclient.tags.all({'include':'recent_posts'})\n```\n\n\n```python\nclient.tags.get('product-updates')\nclient.tags.get('product-updates', {'include':'recent_posts'})\n```\n\n\n[To Top](#buttercms-python)\n\n#### Feeds\n\n```python\nclient.feeds.get('rss')\n```\n\n\n```python\nclient.feeds.get('atom')\n```\n\n\n```python\nclient.feeds.get('sitemap')\n```\n\n\n[To Top](#buttercms-python)\n\n\n\n### Other\n\nView Python [Blog engine](https://buttercms.com/python-blog-engine/) and [Full CMS](https://buttercms.com/python-cms/) for other examples of using ButterCMS with Python.\n\n### Tests\n\nTo run tests:\n\n```python\npython -m unittest butter_cms/unit_tests.py\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "API First Blogging and CMS platform built for developers",
    "version": "2.1.1",
    "project_urls": {
        "Download": "https://github.com/buttercms/buttercms-python/tarball/0.1",
        "Homepage": "https://github.com/buttercms/buttercms-python"
    },
    "split_keywords": [
        "buttercms",
        " sdk",
        " cms",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0aca11655b2d2ad329bd54dbaff47f0376e077a83909ff1364aa0f54e5b2782e",
                "md5": "dbc94459e047031c3fdc88842720feb8",
                "sha256": "236e89da58554ea7ad2e92b4d3204e33901089bc2450e4ed2f22eee67301f5bf"
            },
            "downloads": -1,
            "filename": "buttercms_python-2.1.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dbc94459e047031c3fdc88842720feb8",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 8137,
            "upload_time": "2024-05-07T15:37:43",
            "upload_time_iso_8601": "2024-05-07T15:37:43.143076Z",
            "url": "https://files.pythonhosted.org/packages/0a/ca/11655b2d2ad329bd54dbaff47f0376e077a83909ff1364aa0f54e5b2782e/buttercms_python-2.1.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8524965b4d355952b6f7111b983afa656dde81978527b6c3f58b456a36fd7b31",
                "md5": "d2c64a47631a7da60b83a6e5c85fa42d",
                "sha256": "284aec079918a41df09eb3896e1136d38c9ffae268821b999c9e8101dc912c04"
            },
            "downloads": -1,
            "filename": "buttercms_python-2.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d2c64a47631a7da60b83a6e5c85fa42d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7474,
            "upload_time": "2024-05-07T15:37:44",
            "upload_time_iso_8601": "2024-05-07T15:37:44.094211Z",
            "url": "https://files.pythonhosted.org/packages/85/24/965b4d355952b6f7111b983afa656dde81978527b6c3f58b456a36fd7b31/buttercms_python-2.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-07 15:37:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "buttercms",
    "github_project": "buttercms-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "build",
            "specs": [
                [
                    "==",
                    "1.2.1"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.2.2"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.2"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.7"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.0"
                ]
            ]
        },
        {
            "name": "pyproject_hooks",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.31.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.1"
                ]
            ]
        }
    ],
    "lcname": "buttercms-python"
}
        
Elapsed time: 0.55039s