-
Notifications
You must be signed in to change notification settings - Fork 37
readme: Optimizely DFM #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
convert md to rst
- Loading branch information
commit 1a865538cc8c114c5d2ad7b8105ec5167e84070c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,97 @@ dashboard, please contact your Optimizely account executive. | |
Using the SDK | ||
~~~~~~~~~~~~~ | ||
|
||
See the Optimizely `Full Stack documentation`_ to learn how to | ||
Optimizely instance can be initialized in three | ||
different ways as per your requirement. | ||
|
||
1. Initialize Optimizely with a datafile. This datafile will be used as | ||
ProjectConfig throughout the life of Optimizely instance. | ||
:: | ||
|
||
optimizely.Optimizely( | ||
datafile | ||
) | ||
|
||
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 | ||
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 | ||
will be used initially before any update. | ||
:: | ||
|
||
optimizely.Optimizely( | ||
datafile=None, | ||
sdk_key='put_your_sdk_key_here' | ||
) | ||
|
||
3. Initialize Optimizely by providing a Config Manager that implements a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead, link to |
||
'get_config' method.You may use our Polling Config Manager and | ||
customize it to your need. | ||
:: | ||
|
||
optimizely.Optimizely( | ||
config_manager=custom_config_manager | ||
) | ||
|
||
PollingConfigManager | ||
'''''''''''''''''''' | ||
|
||
The PollingConfigManager asynchronously polls for datafiles from a | ||
specified URL at regular intervals by making HTTP request. | ||
|
||
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. | ||
|
||
**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 | ||
``ProjectConfigManager`` so that it can be used immediately. The initial | ||
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 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 is used to form | ||
the target URL. | ||
|
||
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. | ||
|
||
================ ======================================================== ===================================================================================== | ||
**Property Name** **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. | ||
================ ======================================================== ===================================================================================== | ||
|
||
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 | ||
|
||
``notification_center.add_notification_listener(NotificationTypes.OPTIMIZELY_CONFIG_UPDATE, update_callback)`` | ||
|
||
|
||
For Further details see the Optimizely `Full Stack documentation`_ to learn how to | ||
set up your first Python project and use the SDK. | ||
|
||
Development | ||
|
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. I don't think our example needs to show
datafile=None