Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mkdir_p(args.output_directory)
os.chdir(args.output_directory)
if platform.system() == "Java" and args.nogui is not True:
from inql.widgets.tab import GraphQLPanel
from inql.actions.sendto import SimpleMenuItem, EnhancedHTTPMutator, GraphiQLSenderAction
from inql.actions.setcustomheader import CustomHeaderSetterAction
overrideheaders = {}
graphiql_omnimenu = SimpleMenuItem(text="Send to GraphiQL")
http_mutator = EnhancedHTTPMutator(
requests=args.requests,
stub_responses=args.stub_responses,
overrideheaders=overrideheaders)
graphiql_sender = GraphiQLSenderAction(omnimenu=graphiql_omnimenu, http_mutator=http_mutator)
custom_header_setter = CustomHeaderSetterAction(overrideheaders=overrideheaders, text="Set Custom Header")
cfg = [
['Proxy', args.proxy],
['Authorization Key', args.key],
['Load Placeholders', args.detect],
['Generate HTML DOC', args.generate_html],
['Generate Schema DOC', args.generate_schema],
['Generate Stub Queries', args.generate_queries],
['Accept Invalid SSL Certificate', args.insecure_certificate]
]
return GraphQLPanel(
actions=[custom_header_setter, graphiql_sender],
restore=json.dumps({'config': cfg}),
http_mutator=None,
requests=args.requests,
stub_responses=args.stub_responses
).app()
def getUiComponent(self):
"""
Override ITab method
:return: Tab UI Component
"""
overrideheaders = {}
repeater_omnimenu = OmniMenuItem(callbacks=self._callbacks, helpers=self._helpers, text="Send to Repeater")
graphiql_omnimenu = OmniMenuItem(callbacks=self._callbacks, helpers=self._helpers, text="Send to GraphiQL")
http_mutator = EnhancedHTTPMutator(
callbacks=self._callbacks, helpers=self._helpers, overrideheaders=overrideheaders)
repeater_sender = RepeaterSenderAction(omnimenu=repeater_omnimenu, http_mutator=http_mutator)
graphiql_sender = GraphiQLSenderAction(omnimenu=graphiql_omnimenu, http_mutator=http_mutator)
custom_header_setter = CustomHeaderSetterAction(overrideheaders=overrideheaders, text="Set Custom Header")
try:
restore = self._callbacks.loadExtensionSetting(GraphQLPanel.__name__)
except Exception as ex:
print("Cannot restore state! %s" % ex)
restore = None
proxy = None
for request_listener in json.loads(self._callbacks.saveConfigAsJson())["proxy"]["request_listeners"]:
if request_listener["running"]:
proxy = "localhost:%s" % request_listener["listener_port"]
break
self.panel = GraphQLPanel(
actions=[
repeater_sender,