11eedcde84
- renamed package to mwmbl in pyproject.toml - tinysearchengine and indexer modules have been moved into mwmbl package folder - analyse module has been left as is in the root of the repo - import statements in tinysearchengine now use mwmbl.tinysearchengine - import statements in indexer now use mwmbl.indexer or mwmbl.tinysearchengine or relative imports like .paths - import statements in analyse now use mwmbl.indexer or mwmbl.tinysearchengine - final CMD in Dockerfile now uses updated path mwmbl.tinysearchengine.app - fixed a couple of import statement errors in tinysearchengine/indexer.py
29 lines
696 B
Python
29 lines
696 B
Python
"""
|
|
Make a curl script for testing performance
|
|
"""
|
|
import os
|
|
from itertools import islice
|
|
from urllib.parse import quote
|
|
|
|
from mwmbl.indexer.paths import DATA_DIR
|
|
from mwmbl.indexer.wiki import get_wiki_titles_and_urls
|
|
|
|
URL_TEMPLATE = "http://localhost:8000/complete?q={}"
|
|
CURL_FILE = os.path.join(DATA_DIR, "urls.curl")
|
|
|
|
|
|
def get_urls():
|
|
titles_and_urls = get_wiki_titles_and_urls()
|
|
for title, url in islice(titles_and_urls, 100):
|
|
query = quote(title.lower())
|
|
yield URL_TEMPLATE.format(query)
|
|
|
|
|
|
def run():
|
|
with open(CURL_FILE, 'wt') as output_file:
|
|
for url in get_urls():
|
|
output_file.write(f'url="{url}"\n')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
run()
|