You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
whoogle-search/opensearch.py

20 lines
646 B
Python

import sys
template_path = './app/static/opensearch.template'
opensearch_path = './app/static/opensearch.xml'
replace_tag = 'SHOOGLE_URL'
if len(sys.argv) != 2:
print('You must provide the url as an argument for this script.')
print('Example: python opensearch.py "https://my-app-1776.herokuapps.com"')
sys.exit(0)
app_url = sys.argv[1].rstrip('/')
opensearch_template = open(template_path, 'r').read()
with open(opensearch_path, 'w') as opensearch_xml:
opensearch_xml.write(opensearch_template.replace(replace_tag, app_url))
opensearch_xml.close()
print('\nDone - you may now set Shoogle as your primary search engine')