You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for making this! I needed a quick tool to manipulate HTTP POST requests I had logged in Charles, and this was quite helpful.
When I used it, I needed to make a few changes. The first two are probably no-brainers to add, and I only wanted them to keep knowledge about the JSON structure from leaking out into my tool.
The other thing I needed was to build a session from a file-like object. I'm not sure I've thought that through carefully enough that you'll want to add it just the way I did, but here's how I changed the CharlesSession constructor:
def __init__(self, request_list=list(), path=None, file=None):
if file is not None:
self._all_requests = [CharlesRequest(r) for r in json.load(file)]
elif len(request_list) == 0 and path is not None:
with open(path, 'r') as f:
self._all_requests = [CharlesRequest(r) for r in json.load(f)]
elif len(request_list) > 0 and path is None:
self._all_requests = [CharlesRequest(r) for r in request_list]
else:
self.fail('only one initialization parameter should be specified')
_assign_indexes(self._all_requests)
All my mods and my little tool are all available in my public repo under the same license as pycharles in case you find it interesting or useful.
I haven't used this enough and thought it through carefully enough to make it a pull request (and probably won't end up doing so) but it seemed worth sharing anyway.
The text was updated successfully, but these errors were encountered:
Thanks for making this! I needed a quick tool to manipulate HTTP POST requests I had logged in Charles, and this was quite helpful.
When I used it, I needed to make a few changes. The first two are probably no-brainers to add, and I only wanted them to keep knowledge about the JSON structure from leaking out into my tool.
On the
CharlesRequest
class, I addedThe other thing I needed was to build a session from a file-like object. I'm not sure I've thought that through carefully enough that you'll want to add it just the way I did, but here's how I changed the
CharlesSession
constructor:All my mods and my little tool are all available in my public repo under the same license as pycharles in case you find it interesting or useful.
I haven't used this enough and thought it through carefully enough to make it a pull request (and probably won't end up doing so) but it seemed worth sharing anyway.
The text was updated successfully, but these errors were encountered: