Skip to content

Commit

Permalink
Fixing formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aliabbasrizvi committed Jul 30, 2019
1 parent 9b8fd0a commit 8ebb1f4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 43 deletions.
24 changes: 12 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ July 26th, 2019
### New Features:
* Added support for automatic datafile management via [PollingConfigManager](https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L151):
* The [PollingConfigManager](https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L151) is an implementation of the [BaseConfigManager](https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L32).
* Users may provide one of datafile or SDK key (sdk\_key) or both to [optimizely.Optimizely]{.title-ref}. Based on that, the SDK will use the [StaticConfigManager](https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L73) or the [PollingConfigManager](https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L151). Refer to the [README](README.md) for more instructions.
* An initial datafile can be provided to the [PollingConfigManager]{.title-ref} to bootstrap before making HTTP requests for the hosted datafile.
* Users may provide one of datafile or SDK key (sdk_key) or both to `optimizely.Optimizely`. Based on that, the SDK will use the [StaticConfigManager](https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L73) or the [PollingConfigManager](https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L151). Refer to the [README](README.md) for more instructions.
* An initial datafile can be provided to the `PollingConfigManager` to bootstrap before making HTTP requests for the hosted datafile.
* Requests for the datafile are made in a separate thread and are scheduled with fixed delay.
* Configuration updates can be subscribed to by adding the OPTIMIZELY_CONFIG_UPDATE notification listener.
* Introduced [Optimizely.get\_feature\_variable]{.title-ref} API. ([\#191](https://github.com/optimizely/python-sdk/pull/191))
* Introduced `Optimizely.get_feature_variable` API. ([#191](https://github.com/optimizely/python-sdk/pull/191))

### Deprecated:

* [NotificationCenter.clear\_notifications]{.title-ref} is deprecated as of this release. Please use [NotificationCenter.clear\_notification\_listeners]{.title-ref}. ([\#182](https://github.com/optimizely/python-sdk/pull/182))
* [NotificationCenter.clear\_all\_notifications]{.title-ref} is deprecated as of this release. Please use [NotificationCenter.clear\_all\_notification\_listeners]{.title-ref}. ([\#182](https://github.com/optimizely/python-sdk/pull/182))
* `NotificationCenter.clear_notifications` is deprecated as of this release. Please use `NotificationCenter.clear_notification_listeners`. ([#182](https://github.com/optimizely/python-sdk/pull/182))
* `NotificationCenter.clear_all_notifications` is deprecated as of this release. Please use `NotificationCenter.clear_all_notification_listeners`. ([#182](https://github.com/optimizely/python-sdk/pull/182))

## 3.1.0
May 3rd, 2019
Expand All @@ -27,7 +27,7 @@ May 3rd, 2019
* Feature variable value for users.

### Bug Fixes:
* Feature variable APIs now return default variable value when featureEnabled property is false. ([\#171](https://github.com/optimizely/python-sdk/pull/171))
* Feature variable APIs now return default variable value when featureEnabled property is false. ([#171](https://github.com/optimizely/python-sdk/pull/171))

### Deprecated:
* Activate notification listener is deprecated as of this release. Recommendation is to use the new Decision notification listener. Activate notification listener will be removed in the next major release.
Expand Down Expand Up @@ -64,24 +64,24 @@ targeting functionality.
### Bug Fixes:
* Experiments and features can no longer activate when a negatively targeted attribute has a missing, null, or malformed value.
* Audience conditions (except for the new `exists` matcher) no longer resolve to `false` when they fail to find an legitimate value for the targeted user attribute. The result remains `null` (unknown). Therefore, an audience that negates such a condition (using the `"not"` operator) can no longer resolve to `true` unless there is an unrelated branch in the condition tree that itself resolves to `true`.
* Updated the default event dispatcher to log an error if the request resolves to HTTP 4xx or 5xx. ([\#140](https://github.com/optimizely/python-sdk/pull/140))
* Updated the default event dispatcher to log an error if the request resolves to HTTP 4xx or 5xx. ([#140](https://github.com/optimizely/python-sdk/pull/140))
* All methods now validate that user IDs are strings and that experiment keys, feature keys, feature variable keys, and event keys are non-empty strings.

## 2.1.1
August 21st, 2018

* Fix: record conversions for all experiments using an event when using track([\#136](https://github.com/optimizely/python-sdk/pull/136)).
* Fix: record conversions for all experiments using an event when using track([#136](https://github.com/optimizely/python-sdk/pull/136)).

## 2.1.0
July 2nd, 2018

* Introduced support for bot filtering ([\#121](https://github.com/optimizely/python-sdk/pull/121)).
* Overhauled logging to use standard Python logging ([\#123](https://github.com/optimizely/python-sdk/pull/123)).
* Introduced support for bot filtering ([#121](https://github.com/optimizely/python-sdk/pull/121)).
* Overhauled logging to use standard Python logging ([#123](https://github.com/optimizely/python-sdk/pull/123)).

## 2.0.1
June 19th, 2018

* Fix: send impression event for Feature Test when Feature is disabled ([\#128](https://github.com/optimizely/python-sdk/pull/128)).
* Fix: send impression event for Feature Test when Feature is disabled ([#128](https://github.com/optimizely/python-sdk/pull/128)).

## 2.0.0
April 12th, 2018
Expand Down Expand Up @@ -201,7 +201,7 @@ introduces some breaking changes listed below.
## 0.1.3

* Added support for v2 endpoint and datafile.
* Updated dispatch\_event to consume an Event object instead of url and params. The Event object comprises of four properties: url (string representing URL to dispatch event to), params (dict representing the params to be set for the event), http\_verb (one of 'GET' or 'POST') and headers (header values to be sent along).
* Updated dispatch_event to consume an Event object instead of url and params. The Event object comprises of four properties: url (string representing URL to dispatch event to), params (dict representing the params to be set for the event), http_verb (one of 'GET' or 'POST') and headers (header values to be sent along).
* Fixed issue with tracking events for experiments in groups.

## 0.1.2
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ Development process
-------------------

1. Fork the repository and create your branch from master.
2. Please follow the [commit message
guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines)
2. Please follow the [commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines)
for each commit message.
3. Make sure to add tests!
4. Run `pep8` to ensure there are no lint errors.
Expand Down
61 changes: 32 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Getting Started

### Installing the SDK

The SDK is available through
[PyPi](https://pypi.python.org/pypi?name=optimizely-sdk&:action=display).
The SDK is available through [PyPi](https://pypi.python.org/pypi?name=optimizely-sdk&:action=display).

To install:

pip install optimizely-sdk
Expand All @@ -44,26 +44,24 @@ dashboard, please contact your Optimizely account executive.

### Using the SDK

You can initialize the Optimizely instance in three ways: with a
datafile, by providing an [sdk\_key]{.title-ref}, or by providing an
implementation of
You can initialize the Optimizely instance in three ways: with a datafile, by providing an sdk_key, or by providing an implementation of
[BaseConfigManager](https://github.com/optimizely/python-sdk/tree/master/optimizely/config_manager.py#L32).
Each method is described below.

1. Initialize Optimizely with a datafile. This datafile will be used as
ProjectConfig throughout the life of Optimizely instance. :
the source of ProjectConfig throughout the life of Optimizely instance. :

optimizely.Optimizely(
datafile
)

2. Initialize Optimizely by providing an \'sdk\_key\'. This will
2. Initialize Optimizely by providing an \'sdk_key\'. This will
initialize a PollingConfigManager that makes an HTTP GET request to
the URL (formed using your provided [sdk key]{.title-ref} and the
the URL (formed using your provided sdk key and the
default datafile CDN URL template) to asynchronously download the
project datafile at regular intervals and update ProjectConfig when
a new datafile is received. A hard-coded datafile can also be
provided along with the [sdk\_key]{.title-ref} that will be used
provided along with the sdk_key that will be used
initially before any update. :

optimizely.Optimizely(
Expand All @@ -79,27 +77,34 @@ Each method is described below.

3. Initialize Optimizely by providing a ConfigManager that implements
[BaseConfigManager](https://github.com/optimizely/python-sdk/tree/master/optimizely/config_manager.py#L32).
You may use our [PollingConfigManager]{.title-ref} as needed. :
You may use our [PollingConfigManager](https://github.com/optimizely/python-sdk/blob/master/optimizely/config_manager.py#L151) as needed. :

optimizely.Optimizely(
config_manager=custom_config_manager
)

#### PollingConfigManager

The [PollingConfigManager]{.title-ref} asynchronously polls for
The [PollingConfigManager](https://github.com/optimizely/python-sdk/blob/master/optimizely/config_manager.py#L151) asynchronously polls for
datafiles from a specified URL at regular intervals by making HTTP
requests.

polling\_config\_manager = PollingConfigManager( sdk\_key=None,
datafile=None, update\_interval=None, url=None, url\_template=None,
logger=None, error\_handler=None, notification\_center=None,
skip\_json\_validation=False )

**Note**: You must provide either the [sdk\_key]{.title-ref} or URL. If
polling_config_manager = PollingConfigManager(
sdk_key=None,
datafile=None,
update_interval=None,
url=None,
url_template=None,
logger=None,
error\_handler=None,
notification\_center=None,
skip\_json\_validation=False
)

**Note**: You must provide either the sdk_key or URL. If
you provide both, the URL takes precedence.

**sdk\_key** The [sdk\_key]{.title-ref} is used to compose the outbound
**sdk_key** The sdk_key is used to compose the outbound
HTTP request to the default datafile location on the Optimizely CDN.

**datafile** You can provide an initial datafile to bootstrap the
Expand All @@ -108,11 +113,11 @@ datafile also serves as a fallback datafile if HTTP connection cannot be
established. The initial datafile will be discarded after the first
successful datafile poll.

**update\_interval** The update\_interval is used to specify a fixed
**update_interval** The update_interval is used to specify a fixed
delay in seconds between consecutive HTTP requests for the datafile.

**url\_template** A string with placeholder `{sdk_key}` can be provided
so that this template along with the provided [sdk key]{.title-ref} is
**url_template** A string with placeholder `{sdk_key}` can be provided
so that this template along with the provided sdk key is
used to form the target URL.

You may also provide your own logger, error\_handler, or
Expand All @@ -125,21 +130,19 @@ configurations for [PollingConfigManager]{.title-ref}.

**PropertyName** **Default Value** **Description**
------------------ ----------------------------------------------------------- --------------------------------------------------------------------------------------
update\_interval 5 minutes Fixed delay between fetches for the datafile
sdk\_key None Optimizely project SDK key
url None URL override location used to specify custom HTTP source for the Optimizely datafile
url\_template <https://cdn.optimizely.com/datafiles/%7Bsdk_key%7D.json> Parameterized datafile URL by SDK key
datafile None Initial datafile, typically sourced from a local cached source
update_interval 5 minutes Fixed delay between fetches for the datafile
sdk_key None Optimizely project SDK key
url None URL override location used to specify custom HTTP source for the Optimizely datafile
url_template https://cdn.optimizely.com/datafiles/{sdk_key}.json Parameterized datafile URL by SDK key
datafile None Initial datafile, typically sourced from a local cached source

A notification signal will be triggered whenever a *new* datafile is
fetched and Project Config is updated. To subscribe to these
notifications, use:

`notification_center.add_notification_listener(NotificationTypes.OPTIMIZELY_CONFIG_UPDATE, update_callback)`

For Further details see the Optimizely [Full Stack
documentation](https://docs.developers.optimizely.com/full-stack/docs)
to learn how to set up your first Python project and use the SDK.
For Further details see the Optimizely [Full Stack documentation](https://docs.developers.optimizely.com/full-stack/docs) to learn how to set up your first Python project and use the SDK.

Development
-----------
Expand Down

0 comments on commit 8ebb1f4

Please sign in to comment.