# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Performance test for the Oppia reader view.

Before running this script, exploration 0 should be loaded in the target
server.

Run this script from the Oppia root directory:

    python core/tests/reader_view_load_test.py --thread_count=5 --start_uid=1 \
    https://my-oppia-instance.appspot.com

"""

# Pylint has issues with import order of argparse.
#pylint: disable=wrong-import-order
import argparse
import cookielib
import json
import logging
import sys
import threading
import time
import urllib
import urllib2
#pylint: enable=wrong-import-order


XSSI_PREFIX = ')]}\'\n'


# command line arguments parser
PARSER = argparse.ArgumentParser()
PARSER.add_argument(
    'base_url', help=('Base URL of the Oppia installation to test'), type=str)
PARSER.add_argument(