Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'-P', '--proxy',
help='Proxy URL',
metavar='',
nargs='?')
replayParser.set_defaults(func=checkArgs_replay,
onError=replayParser.print_help)
parser.add_argument(
'-d', '--daemon',
help=("Multi-address of IPFS daemon "
"(default /dns/localhost/tcp/5001/http)"),
default=ipwbUtil.IPFSAPI_MUTLIADDRESS,
dest='daemon_address')
parser.add_argument(
'-v', '--version', help='Report the version of ipwb', action='version',
version='InterPlanetary Wayback ' + ipwbVersion)
argCount = len(argsIn)
cmdList = ['index', 'replay']
baseParserFlagList = ['-d', '--daemon', '-v', '--version']
# Various invocation error, used to show appropriate help
cmdError_index = argCount == 2 and argsIn[1] == 'index'
cmdError_noCommand = argCount == 1
cmdError_invalidCommand = argCount > 1 \
and argsIn[1] not in cmdList + baseParserFlagList
if cmdError_noCommand or cmdError_invalidCommand:
parser.print_help()
sys.exit()
elif cmdError_index:
indexParser.print_help()
def generateCDXJMetadata(cdxjLines=None):
metadata = ['!context ["http://tools.ietf.org/html/rfc7089"]']
metaVals = {
'generator': "InterPlanetary Wayback v.{0}".format(ipwbVersion),
'created_at': '{0}'.format(datetime.datetime.now().isoformat())
}
metaVals = '!meta {0}'.format(json.dumps(metaVals))
metadata.append(metaVals)
return metadata
def setServerHeader(response):
response.headers['Server'] = 'InterPlanetary Wayback Replay/' + ipwbVersion
response.autocorrect_location_header = False
return response