Releases: nylas/nylas-python
v5.1.0
This new release of the Nylas Python SDK brings a couple of critical fixes as well as adding support for Event Conference Sync (Beta).
New Features
- Add Event conferencing support
Enhancements
- Fix
categorized_at
type to beepoch
inNeuralCategorizer
- Fix error when creating events by filtering of "None" value attributes before making requests
v5.0.0
👋 Hey there! It's been a while but we have a new action-packed release for the Python SDK! This new release addresses a lot of issues and bugs. Furthermore we have some new exciting features such as support for the new Nylas Neural API, Event Metadata, and support for new Room Resources fields! Please note that with this release you may need to update your configuration as we have changed the names of the API configuration variables. More information can be found below under "Breaking Changes".
New Features
- Add support for the Nylas Neural API (#163)
- Add
metadata
support (#152) - Add new Room Resource fields (#156)
- Add
Nylas-API-Version
header support (#157)
Enhancements
- Transitioned from
app_id
andapp_secret
naming toclient_id
andclient_secret
(#159) - Fix adding a tracking object to an existing
draft
(#153) - Fix issue when converting offset-aware
datetime
objects totimestamp
(#154) - Fix
limit
value in filter not being used when making.all()
call (#155) - Fix
from_
field set by attribute on draft ignored (#162) - Remove
bumpversion
from a required dependency to an extra dependency (#158)
Breaking Changes
API Configuration
The Python SDK previously used the variable names app_id
and app_secret
for the API configuration. They have now changed to client_id
and client_secret
. In the other Nylas components like the API and other SDKs the values are referred to as the Client ID and the Client Secret so this change was made for consistency and to reduce confusion.
If you were previously initializing APIClient
by passing in the credentials as a variable assignment, you are required to update your code to reflect the new credential variable names:
client = APIClient(
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET",
)
If you were initializing it by just passing in the values in order like so:
client = APIClient(
"CLIENT_ID",
"CLIENT_SECRET",
)
then no change is required on your part.
Using New Features
Neural API
To use Sentiment Analysis:
# To perform sentiment analysis on a message, pass in the list of message ID:
message_analysis = nylas.neural.sentiment_analysis_message([MESSAGE_ID])
# To perform sentiment analysis on just text, pass in a string:
text_analysis = nylas.neural.sentiment_analysis_text("Hi, thank you so much for reaching out! We can catch up tomorrow.")
To use Signature Extraction:
const signature = nylas.neural.extract_signature([MESSAGE_ID])
# The method also accepts two optional parameters
# parseContact, a boolean for whether Nylas should parse the contact from the signature (API defaults to true)
# options, an object of options that can be enabled for the Neural endpoint, of type NeuralMessageOptions:
options = NeuralMessageOptions(
ignore_links=False,
ignore_images=False,
ignore_tables=False,
remove_conclusion_phrases=False,
images_as_markdowns=False
)
signature = nylas.neural.extract_signature([MESSAGE_ID], true, options)
and to parse the contact and convert it to the standard Nylas contact object:
contact = signature[0].contacts.to_contact_object()
To use Clean Conversations:
convo = nylas.neural.clean_conversation([MESSAGE_ID])
# You can also pass in an object of options that can be enabled for the Neural endpoint, of type NeuralMessageOptions
convo = nylas.neural.clean_conversation([MESSAGE_ID], options);
and to extract images from the result:
convo[0].extract_images()
To use Optical Character Recognition:
ocr = nylas.neural.ocr_request(FILE_ID)
# This endpoint also supports a second, optional parameter for an array specifying the pages that the user wants analyzed:
ocr = nylas.neural.ocr_request(FILE_ID, [2, 3])
To use Categorizer
cat = nylas.neural.categorize([MESSAGE_ID])
# You can also send a request to recategorize the message:
cat = cat[0].recategorize("conversation")
Event Metadata
# To filter using either metadata_key or metadata_value you can pass in a string:
events = nylas.events.where(metadata_key='hello').all()
# or, you can pass in multiple strings as an array:
events = nylas.events.where(metadata_value=['value1', 'value2']).all()
# To filter on `metadata_pair` you can pass in a `dict` of key-value pairs to use in the query:
events = nylas.events.where(metadata_pair={'hello': 'world'}).all()
v4.12.1
Bump version: 4.12.0 → 4.12.1
v4.12.0
Bump version: 4.11.0 → 4.12.0
v4.11.0
Bump version: 4.10.0 → 4.11.0
v4.9.0
Bump version: 4.8.1 → 4.9.0
4.7.0
v3.0.0
Release Notes
Large changes
- The Nylas Python SDK now fully supports both Python 2.7 and Python 3.3+.
- The SDK has a new dependency: the
URLObject library.
This dependency will be automatically installed when you upgrade. - The SDK now automatically converts between timestamps and Python datetime
objects. These automatic conversions are opt-in: your existing code should
continue to work unmodified. See the "Timestamps and Datetimes"
section of this document for more information.
Small changes
- The SDK now has over 95% automated test coverage.
- Previously, trying to access the following model properties would raise an error:
Folder.threads
,Folder.messages
,Label.threads
,Label.messages
.
These properties should now work as expected. - The
Thread
model now exposes thelast_message_received_timestamp
and
last_message_sent_timestamp
properties, obtained from the Nylas API. - Previously, if you created a
Draft
object, saved it, and then
deleted it without modifying it further, the deletion would fail silently.
Now, the SDK will actually attempt to delete a newly-savedDraft
object,
and will raise an error if it is unable to do so. - Previously, you could initialize an
APIClient
with anapi_server
value set to anhttp://
URL. Now,APIClient
will verify that the
api_server
value starts withhttps://
, and will raise an error if it
does not. - The
APIClient
constructor no longers accepts theauth_server
argument,
as it was never used for anything. - The
nylas.client.util.url_concat
andnylas.client.util.generate_id
functions have been removed. These functions were meant for internal use,
and were never documented or expected to be used by others. - You can now pass a
state
argument toAPIClient.authentication_url()
,
as per the OAuth 2.0 spec.
Timestamps and Datetimes
Some properties in the Nylas API use timestamp integers to represent a specific
moment in time, such as Message.date
. The Python SDK now exposes new properties
that have converted these existing properties from integers to Python datetime
objects. You can still access the existing properties to get the timestamp
integer -- these new properties are just a convenient way to access Python
datetime objects, if you want them.
This table summarizes the new datetime properties, and which existing timestamp
properties they match up with.
New Property (datetime) | Existing Property (timestamp) |
---|---|
Message.received_at |
Message.date |
Thread.first_message_at |
Thread.first_message_timestamp |
Thread.last_message_at |
Thread.last_message_timestamp |
Thread.last_message_received_at |
Thread.last_message_received_timestamp |
Thread.last_message_sent_at |
Thread.last_message_sent_timestamp |
Draft.last_modified_at |
Draft.date |
Event.original_start_at |
Event.original_start_time |
You can also use datetime objects when filtering on models with the .where()
method. For example, if you wanted to find all messages that were received
before Jan 1, 2015, previously you would run this code:
client.messages.where(received_before=1420070400).all()
That code will still work, but if you prefer, you can run this code instead:
from datetime import datetime
client.messages.where(received_before=datetime(2015, 1, 1)).all()
You can now use datetimes with the following filters:
client.messages.where(received_before=datetime())
client.messages.where(received_after=datetime())
client.threads.where(last_message_before=datetime())
client.threads.where(last_message_after=datetime())
client.threads.where(started_before=datetime())
client.threads.where(started_after=datetime())
v2.0.0
- Add support for expanded message view
- Remove deprecated "Inbox" name
- Send correct auth headers for account management
- Respect the offset parameter for restfulmodelcollection
- Add ability to revoke token
v1.2.0
Please see the change log for full details: https://github.com/nylas/nylas-python/blob/master/CHANGELOG.md
- Deprecate tags and tag-related functions.
- Return message object when sending a draft
- Support passing parameters and request bodies on delete