Skip to content

Commit

Permalink
Fixed haraws
Browse files Browse the repository at this point in the history
  • Loading branch information
andydude committed Aug 1, 2017
1 parent e092127 commit 47531b9
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions haraws
Original file line number Diff line number Diff line change
@@ -1,58 +1,50 @@
#!/usr/bin/env python3
# Copyright 2012 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at

# http://aws.amazon.com/apache2.0/

# the License is located at <http://aws.amazon.com/apache2.0/>
# or in the "license" file accompanying this file. This file 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.
'''TODO.'''
from functools import update_wrapper
import sys
import awscli.clidriver
import botocore.endpoint
from botocore.endpoint import BotocoreHTTPSession
from harlib.objects import HarFile

_BotocoreHTTPSession = BotocoreHTTPSession
_BotocoreHTTPSession_init = BotocoreHTTPSession.__init__
_BotocoreHTTPSession_send = BotocoreHTTPSession.send
_default_filename = 'out.har'
_entries = []
BOTOCOREHTTPSESSION_SEND = BotocoreHTTPSession.send
FILENAME = 'out.har'
ENTRIES = []


def har_send(self, request, **kwargs):
'''TODO.'''
response = _BotocoreHTTPSession_send(self, request, **kwargs)
response = BOTOCOREHTTPSESSION_SEND(self, request, **kwargs)
response.request = request.original
_entries.append(response)
ENTRIES.append(response)
return response


def har_patch():
'''TODO.'''
botocore.endpoint.BotocoreHTTPSession.send = \
update_wrapper(har_send, _BotocoreHTTPSession_send)
update_wrapper(har_send, BOTOCOREHTTPSESSION_SEND)


def har_dump():
'''TODO.'''
har_file = HarFile(_entries)
har_file = HarFile(ENTRIES)
print(har_file.dumps())


def main():
'''TODO.'''
har_patch()

status = awscli.clidriver.main()

har_dump()

return status


Expand Down

0 comments on commit 47531b9

Please sign in to comment.