Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / testing / legion / examples / http_example / http_client.py
blob3153cdf90ae7f6be9730aba1bcf5c604859161d9
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import argparse
6 import httplib
7 import sys
10 def GetArgs():
11 """Returns the specified command line args."""
12 parser = argparse.ArgumentParser()
13 parser.add_argument('--server', required=True)
14 parser.add_argument('--port', required=True, type=int)
15 return parser.parse_args()
18 def main():
19 """Get the webpage and assert the text == 'SUCCESS!'."""
20 args = GetArgs()
21 conn = httplib.HTTPConnection(args.server, args.port)
22 conn.request('GET', '/')
23 response = conn.getresponse().read()
24 assert response == 'SUCCESS!', '%s != SUCCESS!' % response
27 if __name__ == '__main__':
28 sys.exit(main())