@POST('^/api/v1/settings')
    @authenticated
    def set_settings(self, request):
        try:
            settings = self.db.settings
            resolver = RESOLVER if "resolver" not in request.args or request.args["resolver"][0] == "" \
                else request.args["resolver"][0]
            if "libbitcoin_server" in request.args and \
                            request.args["libbitcoin_server"][0] != "" and \
                            request.args["libbitcoin_server"][0] != "null":
                if self.protocol.testnet:
                    set_value("LIBBITCOIN_SERVERS_TESTNET", "testnet_server_custom",
                              request.args["libbitcoin_server"][0])
                else:
                    set_value("LIBBITCOIN_SERVERS", "mainnet_server_custom",
                              request.args["libbitcoin_server"][0])
            else:
                if self.protocol.testnet:
                    if get_value("LIBBITCOIN_SERVERS_TESTNET", "testnet_server_custom"):
                        delete_value("LIBBITCOIN_SERVERS_TESTNET", "testnet_server_custom")
                else:
                    if get_value("LIBBITCOIN_SERVERS", "mainnet_server_custom"):
                        delete_value("LIBBITCOIN_SERVERS", "mainnet_server_custom")
            if resolver != get_value("CONSTANTS", "RESOLVER"):
                set_value("CONSTANTS", "RESOLVER", resolver)

            settings_list = settings.get()
            if "moderators" in request.args and settings_list is not None:
                mod_json = settings_list[11]
                if mod_json != "":
                    prev_mods = json.loads(mod_json)
                    current_mods = request.args["moderators"]
                    to_add = list(set(current_mods) - set(prev_mods))
                    to_remove = list(set(prev_mods) - set(current_mods))
                    if len(to_remove) > 0 or len(to_add) > 0:
                        self.mserver.update_moderators_on_listings(request.args["moderators"])

            settings.update(
                request.args["refund_address"][0],
                request.args["currency_code"][0],
                request.args["country"][0],
                request.args["language"][0],
                request.args["time_zone"][0],
                1 if str_to_bool(request.args["notifications"][0]) else 0,
                json.dumps(request.args["shipping_addresses"] if request.args["shipping_addresses"] != "" else []),
                json.dumps(request.args["blocked"] if request.args["blocked"] != "" else []),
                request.args["terms_conditions"][0],
                request.args["refund_policy"][0],
                json.dumps(request.args["moderators"] if request.args["moderators"] != "" else [])
            )

            request.write(json.dumps({"success": True}, indent=4))
            request.finish()
            return server.NOT_DONE_YET
        except Exception, e:
            request.write(json.dumps({"success": False, "reason": e.message}, indent=4))
            request.finish()
            return server.NOT_DONE_YET
dataset/ETHPy150Open OpenBazaar/OpenBazaar-Server/api/restapi.py/OpenBazaarAPI.set_settings/original