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
| flowchart TD | |
| User@{ shape: manual-input, label: "User"} -->|GET| App{Your Application} | |
| App -->|Context + Flag Key| LDClient[LaunchDarkly SDK Client] | |
| LDClient -->|get flag value| LDServer[LaunchDarkly Service] | |
| LDServer -->|receive flag value| LDClient | |
| LDClient -->|flag value| App | |
| App -->|Delivers user experience| User |
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
| import ldclient | |
| from ldclient.config import Config | |
| from ldclient import Context | |
| ldclient.set_config(Config('sdk-copy-your-sdk-key-here')) | |
| client = ldclient.get() | |
| if __name__ == "__main__": | |
| alice = Context.builder('user-id-123abc1').kind('user').name('Alice').set('email', '[email protected]').build() |
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
| import ldclient | |
| from ldclient.config import Config | |
| from ldclient import Context | |
| # Import your application | |
| from yourapp import App | |
| # Instantiate your application | |
| app = App() |
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
| import ldclient | |
| from ldclient.config import Config | |
| from ldclient import Context | |
| ldclient.set_config(Config('sdk-copy-your-key-here')) | |
| client = ldclient.get() | |
| if __name__ == "__main__": | |
| if client.is_initialized(): |
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
| import ldclient | |
| from ldclient.config import Config | |
| from ldclient import Context | |
| ldclient.set_config(Config('sdk-copy-your-key-here')) | |
| client = ldclient.get() | |
| if __name__ == "__main__": | |
| if client.is_initialized(): |
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
| import ldclient | |
| from ldclient.config import Config | |
| from ldclient import Context | |
| ldclient.set_config(Config('sdk-copy-your-key-here')) | |
| client = ldclient.get() | |
| if __name__ == "__main__": | |
| if client.is_initialized(): |
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
| from flask import Flask | |
| from flask import request | |
| from tasks import store_db | |
| app = Flask(__name__) | |
| @app.route('/blink', methods=['GET', 'POST']) | |
| def blink(): |
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
| nps = lambda x: float(((len([i for i in x if i > 8]) / len(x)) * 100) - ((len([i for i in x if i < 7]) / len(x)) * 100)) |
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
| from locust import HttpLocust, TaskSet, task | |
| class UserBehavior(TaskSet): | |
| @task(5) | |
| def positive(self): | |
| self.client.post("/sms", {"AddOns": '{"status":"successful","message":null,"code":null,"results":{"mobilecommons_optout":{"request_sid":"XR8b9aa36363d6f4ec4fe42dade911baa6","status":"successful","message":null,"code":null,"result":{"probability":0}},"ibm_watson_insights":{"request_sid":"XR2ad003f13c531200832776b7e1df7190","status":"failed","message":"Request timed out","code":61001,"result":{}},"ibm_watson_sentiment":{"request_sid":"XRb80b1d857cffed90098863f17d040f21","status":"successful","message":null,"code":null,"result":{"status":"OK","usage":"By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html","totalTransactions":"1","language":"english","docSentiment":{"score":"0.629583","type":"positive"}}}}}'}) | |
| @task(1) | |
| def negative(self): |
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
| var twilio = require('twilio'); | |
| // Will use TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN env vars | |
| var twilio_client = new Twilio(); | |
| var notify = client.notifications.v1.services("ISxxxx"); | |
| // create list of installs and declare signal_peeps | |
| signal_peeps.forEach(function(signal_peep) { | |
| notify.bindings.create({ | |
| identity: signal_peep.email_address, | |
| tag: "SIGNAL attendee" | |
| }).then(function(response) { |