Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update readme
  • Loading branch information
oakbani committed Jul 15, 2019
commit 07f449d25141397580c7a51c709ca75e199a647e
35 changes: 16 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ dashboard, please contact your Optimizely account executive.
Using the SDK
~~~~~~~~~~~~~

Optimizely instance can be initialized in three
different ways as per your requirement.
You can initialize the Optimizely instance in three ways: with a datafile, by providing an `sdk_key`, or by providing a Config Manager. Each method is described below.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link ConfigManager to config_manager.py


1. Initialize Optimizely with a datafile. This datafile will be used as
ProjectConfig throughout the life of Optimizely instance.
Expand All @@ -42,11 +41,11 @@ different ways as per your requirement.
)

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 and the default datafile CDN url
a PollingConfigManager that makes an HTTP GET request to the URL (formed
using your provided `sdk key` and the default datafile CDN url

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put "URL" in capital letters?

template) to asynchronously download the project datafile at regular
intervals and update ProjectConfig when a new datafile is recieved. A
hard-coded datafile can also be provided along with the sdk_key that
hard-coded datafile can also be provided along with the `sdk_key` that
will be used initially before any update.
::

Expand All @@ -56,8 +55,7 @@ different ways as per your requirement.
)

3. Initialize Optimizely by providing a Config Manager that implements a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, link to BaseConfigManager and ask for user to implement BaseConfigManager.

'get_config' method.You may use our Polling Config Manager and
customize it to your need.
'get_config' method. You may use our `PollingConfigManager` as needed.
::

optimizely.Optimizely(
Expand All @@ -67,18 +65,17 @@ different ways as per your requirement.
PollingConfigManager
''''''''''''''''''''

The PollingConfigManager asynchronously polls for datafiles from a
specified URL at regular intervals by making HTTP request.
The `PollingConfigManager` 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**: One of the sdk_key or url must be provided. When both are
provided, url takes the preference.
**Note**: You must provide either the `sdk_key` or URL. If you provide both, the URL takes precedence.

**sdk_key** The sdk_key is used to compose the outbound HTTP request to
**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 @@ -91,31 +88,31 @@ successful datafile poll.
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 is used to form
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
You may also provide your own logger, error_handler, or
notification_center.

Advanced configuration
''''''''''''''''''''''

The following properties can be set to override the default
configurations for PollingConfigManager.
configurations for `PollingConfigManager`.

================ ======================================================== =====================================================================================
**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/{sdk_key}.json Parameterized datafile URL by SDK key.
datafile None Initial datafile, typically sourced from a local cached source.
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 you can use the
notifications, use the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this instead?
To subscribe to these notifications, use:


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

Expand Down