richtermb / pycharles Goto Github PK
View Code? Open in Web Editor NEWUse Python to manipulate Charles session files and send HTTP requests.
License: MIT License
Use Python to manipulate Charles session files and send HTTP requests.
License: MIT License
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 added
def get_headers(self):
return self.request_dict['request']['header']['headers']
def get_body(self):
return self.request_dict['request']['body']['text']
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.