-
Notifications
You must be signed in to change notification settings - Fork 4
/
customEngine.py
63 lines (48 loc) · 1.89 KB
/
customEngine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from yattag import Doc, indent
def createXML():
doc, tag, text = Doc().tagtext()
id='wvsnl7ztkuw'
text('<?xml version="1.0" encoding="UTF-8" ?>\n')
with tag('CustomSearchEngine', id=id):
with tag('Title'):
text('Custom Search Engine')
with tag('Context'):
with tag('BackgroundLabels'):
with tag('Label', name='_cse_'+id, mode='FILTER'):
pass
with tag('Label', name='_cse_exclude_' + id, mode='ELIMINATE'):
pass
with tag('LookAndFeel', nonprofit='false', element_layout='8', theme='7', custom_theme='true', text_font='Arial sans-serif', element_branding='show', enable_cse_thumbnail='true', promotion_url_length='full', ads_layout='1'):
with tag('Logo'):
pass
with tag('Colors'):
pass
with tag('Promotions'):
pass
with tag('SearchControls'):
pass
with tag('Results'):
pass
with tag('AdSense'):
pass
with tag('EnterpriseAccount'):
pass
with tag('ImageSearchSettings', enable='false'):
pass
with tag('autocomplete_settings'):
pass
with tag('sort_by_keys', label='Relevance', key=''):
pass
with tag('sort_by_keys', label='Date', key='date'):
pass
with tag('cse_advance_settings', enable_speech='true'):
pass
result = indent(doc.getvalue(), indentation=' '*4, newline='\r\n')
return result
def writeToFile(fileName, XMLFile):
with open(fileName, 'w') as outFile:
outFile.writelines(XMLFile)
def main():
writeToFile('customEngine.xml', createXML())
if __name__ == '__main__':
main()