nylas


Namenylas JSON
Version 6.1.1 PyPI version JSON
download
home_pagehttps://github.com/nylas/nylas-python
SummaryPython bindings for the Nylas API platform.
upload_time2024-03-05 22:48:16
maintainer
docs_urlNone
authorNylas Team
requires_python>=3.8
licenseMIT
keywords inbox app appserver email nylas contacts calendar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <a href="https://www.nylas.com/">
    <img src="https://brand.nylas.com/assets/downloads/logo_horizontal_png/Nylas-Logo-Horizontal-Blue_.png" alt="Aimeos logo" title="Aimeos" align="right" height="60" />
</a>

# Nylas Python SDK

[![PyPI - Version](https://img.shields.io/pypi/v/nylas)](https://pypi.org/project/nylas/)
[![codecov](https://codecov.io/gh/nylas/nylas-python/branch/main/graph/badge.svg?token=HyxGAn5bJR)](https://codecov.io/gh/nylas/nylas-python)

This is the GitHub repository for the Nylas Python SDK. The repo is primarily for anyone who wants to install the SDK from source or make contributions to it.

If you're looking to use Python to access the Nylas Email, Calendar, or Contacts APIs, see our [Python SDK Quickstart guide](https://docs.nylas.com/docs/quickstart-python).

The Nylas platform provides REST APIs for [Email](https://docs.nylas.com/docs/quickstart-email), [Calendar](https://docs.nylas.com/docs/quickstart-calendar), and [Contacts](https://docs.nylas.com/docs/quickstart-contacts), and the Python SDK is the quickest way to build your integration using Python.

Here are some resources to help you get started:

- [Sign up for a free Nylas account](https://dashboard.nylas.com/register).
- Follow the [Nylas API v3 Quickstart guide](https://developer.nylas.com/docs/v3-beta/v3-quickstart/).
- Browse the [Nylas SDK reference docs](https://nylas-python-sdk-reference.pages.dev/).
- Browse the [Nylas API reference docs](https://developer.nylas.com/docs/api/).
- See our code samples in the [Nylas Samples repo](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=python).

If you have any questions about the Nylas platform, please reach out to support@nylas.com.

## ⚙️ Install

The Nylas Python SDK is available via pip:

```bash
pip install nylas --pre
```

To install the SDK from source, clone this repo and run the install script:

```bash
git clone https://github.com/nylas/nylas-python.git && cd nylas-python
python setup.py install
```

## ⚡️ Usage

Before you use the Nylas Python SDK, you must first [create a Nylas account](https://dashboard.nylas.com/register). Then, follow our [API v3 Quickstart guide](https://developer.nylas.com/docs/v3-beta/v3-quickstart/) to set up your first app and get your API keys.

For code samples and example applications, take a look at our [Python repos in the Nylas Samples collection](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=python).

### 🚀 Make your first request

After you've installed and set up the Nylas Python SDK, you can make your first API request. To do so, use the `Client` class from the `nylas` package.

The SDK is organized into different resources, each of which has methods to make requests to the Nylas API. Each resource is available through the `Client` object that you configured with your API key. For example, you can use this code to get a list of Calendars:

```python
from nylas import Client

nylas = Client(
    api_key="API_KEY",
)

calendars, request_id, next_cursor = nylas.calendars.list("GRANT_ID")

event, request_id = nylas.events.create(
    identifier="GRANT_ID",
    request_body={
        "title": "test title",
        "description": "test description",
        "when": {
            "start_time": start_unix_timestamp,
            "end_time": end_unix_timestamp,
        }
    },
    query_params={"calendar_id": "primary", "notify_participants": True},
    )
)

event, request_id = nylas.events.find(
    identifier="GRANT_ID",
    event_id=event.id,
    query_params={
        "calendar_id": "primary",
    },
)

nylas.events.destroy("GRANT_ID", event.id, {"calendar_id": "primary"})

```

## 📚 Documentation

This SDK makes heavy use of [Python 3 dataclasses](https://realpython.com/python-data-classes/) to define the REST resources and request/response schemas of the Nylas APIs. The Client object is a wrapper around all of these resources and is used to interact with the corresponding APIs. Basic CRUD operations are handled by the `create()`, `find()`, `list()`, `update()`, and `destroy()` methods on each resource. Resources may also have other methods which are all detailed in the [reference guide for the Python SDK](https://nylas-python-sdk-reference.pages.dev/). In the code reference, start at `client`, and then `resources` will give more info on available API call methods. `models` is the place to find schemas for requests, responses, and all Nylas object types.

While most resources are accessed via the top-level Client object, note that `auth` contains the sub-resource `grants` as well as a collection of other auth-related API calls.

You'll want to catch `nylas.models.errors.NylasAPIError` to handle errors.

Have fun!!

## ✨ Upgrade from v5.x

See [UPGRADE.md](UPGRADE.md) for instructions on upgrading from v5.x to v6.x.

## 💙 Contribute

Please refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.

## 🛠️  Debugging

It can sometimes be helpful to turn on request logging during development. Adding the following snippet to your code that calls the SDK should get you sorted:

```
import logging
import requests

# Set up logging to print out HTTP request information
logging.basicConfig(level=logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
```

## 📝 License

This project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE) for the full terms.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nylas/nylas-python",
    "name": "nylas",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "inbox app appserver email nylas contacts calendar",
    "author": "Nylas Team",
    "author_email": "support@nylas.com",
    "download_url": "https://files.pythonhosted.org/packages/b1/86/28ae3e0ebcd3a06b3fbe2e4daaf231484b9ca86399371263bc40b9116c22/nylas-6.1.1.tar.gz",
    "platform": null,
    "description": "<a href=\"https://www.nylas.com/\">\n    <img src=\"https://brand.nylas.com/assets/downloads/logo_horizontal_png/Nylas-Logo-Horizontal-Blue_.png\" alt=\"Aimeos logo\" title=\"Aimeos\" align=\"right\" height=\"60\" />\n</a>\n\n# Nylas Python SDK\n\n[![PyPI - Version](https://img.shields.io/pypi/v/nylas)](https://pypi.org/project/nylas/)\n[![codecov](https://codecov.io/gh/nylas/nylas-python/branch/main/graph/badge.svg?token=HyxGAn5bJR)](https://codecov.io/gh/nylas/nylas-python)\n\nThis is the GitHub repository for the Nylas Python SDK. The repo is primarily for anyone who wants to install the SDK from source or make contributions to it.\n\nIf you're looking to use Python to access the Nylas Email, Calendar, or Contacts APIs, see our [Python SDK Quickstart guide](https://docs.nylas.com/docs/quickstart-python).\n\nThe Nylas platform provides REST APIs for [Email](https://docs.nylas.com/docs/quickstart-email), [Calendar](https://docs.nylas.com/docs/quickstart-calendar), and [Contacts](https://docs.nylas.com/docs/quickstart-contacts), and the Python SDK is the quickest way to build your integration using Python.\n\nHere are some resources to help you get started:\n\n- [Sign up for a free Nylas account](https://dashboard.nylas.com/register).\n- Follow the [Nylas API v3 Quickstart guide](https://developer.nylas.com/docs/v3-beta/v3-quickstart/).\n- Browse the [Nylas SDK reference docs](https://nylas-python-sdk-reference.pages.dev/).\n- Browse the [Nylas API reference docs](https://developer.nylas.com/docs/api/).\n- See our code samples in the [Nylas Samples repo](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=python).\n\nIf you have any questions about the Nylas platform, please reach out to support@nylas.com.\n\n## \u2699\ufe0f Install\n\nThe Nylas Python SDK is available via pip:\n\n```bash\npip install nylas --pre\n```\n\nTo install the SDK from source, clone this repo and run the install script:\n\n```bash\ngit clone https://github.com/nylas/nylas-python.git && cd nylas-python\npython setup.py install\n```\n\n## \u26a1\ufe0f Usage\n\nBefore you use the Nylas Python SDK, you must first [create a Nylas account](https://dashboard.nylas.com/register). Then, follow our [API v3 Quickstart guide](https://developer.nylas.com/docs/v3-beta/v3-quickstart/) to set up your first app and get your API keys.\n\nFor code samples and example applications, take a look at our [Python repos in the Nylas Samples collection](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=python).\n\n### \ud83d\ude80 Make your first request\n\nAfter you've installed and set up the Nylas Python SDK, you can make your first API request. To do so, use the `Client` class from the `nylas` package.\n\nThe SDK is organized into different resources, each of which has methods to make requests to the Nylas API. Each resource is available through the `Client` object that you configured with your API key. For example, you can use this code to get a list of Calendars:\n\n```python\nfrom nylas import Client\n\nnylas = Client(\n    api_key=\"API_KEY\",\n)\n\ncalendars, request_id, next_cursor = nylas.calendars.list(\"GRANT_ID\")\n\nevent, request_id = nylas.events.create(\n    identifier=\"GRANT_ID\",\n    request_body={\n        \"title\": \"test title\",\n        \"description\": \"test description\",\n        \"when\": {\n            \"start_time\": start_unix_timestamp,\n            \"end_time\": end_unix_timestamp,\n        }\n    },\n    query_params={\"calendar_id\": \"primary\", \"notify_participants\": True},\n    )\n)\n\nevent, request_id = nylas.events.find(\n    identifier=\"GRANT_ID\",\n    event_id=event.id,\n    query_params={\n        \"calendar_id\": \"primary\",\n    },\n)\n\nnylas.events.destroy(\"GRANT_ID\", event.id, {\"calendar_id\": \"primary\"})\n\n```\n\n## \ud83d\udcda Documentation\n\nThis SDK makes heavy use of [Python 3 dataclasses](https://realpython.com/python-data-classes/) to define the REST resources and request/response schemas of the Nylas APIs. The Client object is a wrapper around all of these resources and is used to interact with the corresponding APIs. Basic CRUD operations are handled by the `create()`, `find()`, `list()`, `update()`, and `destroy()` methods on each resource. Resources may also have other methods which are all detailed in the [reference guide for the Python SDK](https://nylas-python-sdk-reference.pages.dev/). In the code reference, start at `client`, and then `resources` will give more info on available API call methods. `models` is the place to find schemas for requests, responses, and all Nylas object types.\n\nWhile most resources are accessed via the top-level Client object, note that `auth` contains the sub-resource `grants` as well as a collection of other auth-related API calls.\n\nYou'll want to catch `nylas.models.errors.NylasAPIError` to handle errors.\n\nHave fun!!\n\n## \u2728 Upgrade from v5.x\n\nSee [UPGRADE.md](UPGRADE.md) for instructions on upgrading from v5.x to v6.x.\n\n## \ud83d\udc99 Contribute\n\nPlease refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.\n\n## \ud83d\udee0\ufe0f  Debugging\n\nIt can sometimes be helpful to turn on request logging during development. Adding the following snippet to your code that calls the SDK should get you sorted:\n\n```\nimport logging\nimport requests\n\n# Set up logging to print out HTTP request information\nlogging.basicConfig(level=logging.DEBUG)\nrequests_log = logging.getLogger(\"requests.packages.urllib3\")\nrequests_log.setLevel(logging.DEBUG)\nrequests_log.propagate = True\n```\n\n## \ud83d\udcdd License\n\nThis project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE) for the full terms.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python bindings for the Nylas API platform.",
    "version": "6.1.1",
    "project_urls": {
        "Homepage": "https://github.com/nylas/nylas-python"
    },
    "split_keywords": [
        "inbox",
        "app",
        "appserver",
        "email",
        "nylas",
        "contacts",
        "calendar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b18628ae3e0ebcd3a06b3fbe2e4daaf231484b9ca86399371263bc40b9116c22",
                "md5": "0522436ea5976ef371e0702d992fbe2b",
                "sha256": "4472c43dc514579c32785048428101e452c72fc0f1bfa074a6503621142b15b1"
            },
            "downloads": -1,
            "filename": "nylas-6.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0522436ea5976ef371e0702d992fbe2b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 42430,
            "upload_time": "2024-03-05T22:48:16",
            "upload_time_iso_8601": "2024-03-05T22:48:16.481999Z",
            "url": "https://files.pythonhosted.org/packages/b1/86/28ae3e0ebcd3a06b3fbe2e4daaf231484b9ca86399371263bc40b9116c22/nylas-6.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 22:48:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nylas",
    "github_project": "nylas-python",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "nylas"
}
        
Elapsed time: 0.19992s