# Path: theHarvester/__main__.py
# async def start(rest_args=None):
#     async def store(search_engine: Any, source: str, process_param: Any = None, store_host: bool = False,
#                     store_emails: bool = False, store_ip: bool = False, store_people: bool = False,
#                     store_links: bool = False, store_results: bool = False,
#                     store_interestingurls: bool = False, store_asns: bool = False) -> None:
#     async def worker(queue):
#     async def handler(lst):
# async def entry_point():


import argparse
import os
from typing import List
from fastapi import FastAPI, Header, Query, Request
from fastapi.responses import HTMLResponse, UJSONResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address
from starlette.responses import RedirectResponse
from starlette.staticfiles import StaticFiles
from theHarvester import __main__
                text-align: center;
                display: block;
                }
            </style>
        </head>
        <body>
            <br/>
            <a href="https://github.com/laramies/theHarvester" target="_blank">
            <span class="img-container">
                <img src="https://raw.githubusercontent.com/laramies/theHarvester/master/theHarvester-logo.png" alt="theHarvester logo"/>
            </span>
            </a>
        </body>
    </html>
    """
    return html


@app.get('/nicebot')
async def bot():
    # nice bot
    string = {'bot': 'These are not the droids you are looking for'}
    return string


@app.get('/sources', response_class=UJSONResponse)
@limiter.limit('5/minute')
async def getsources(request: Request):
    # Endpoint for user to query for available sources theHarvester supports
    # Rate limit of 5 requests per minute

# Path: theHarvester/__main__.py
# async def start(rest_args=None):
#     async def store(search_engine: Any, source: str, process_param: Any = None, store_host: bool = False,
#                     store_emails: bool = False, store_ip: bool = False, store_people: bool = False,
#                     store_links: bool = False, store_results: bool = False,
#                     store_interestingurls: bool = False, store_asns: bool = False) -> None:
#     async def worker(queue):
#     async def handler(lst):
# async def entry_point():


# Path: theHarvester/lib/api/api.py
import argparse
import os
from typing import List
from fastapi import FastAPI, Header, Query, Request
from fastapi.responses import HTMLResponse, UJSONResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address
from starlette.responses import RedirectResponse
from starlette.staticfiles import StaticFiles
from theHarvester import __main__

                text-align: center;
                display: block;
                }
            </style>
        </head>
        <body>
            <br/>
            <a href="https://github.com/laramies/theHarvester" target="_blank">
            <span class="img-container">
                <img src="https://raw.githubusercontent.com/laramies/theHarvester/master/theHarvester-logo.png" alt="theHarvester logo"/>
            </span>
            </a>
        </body>
    </html>
    """
    return html


@app.get('/nicebot')
async def bot():
    # nice bot
    string = {'bot': 'These are not the droids you are looking for'}
    return string


@app.get('/sources', response_class=UJSONResponse)
@limiter.limit('5/minute')
async def getsources(request: Request):
    # Endpoint for user to query for available sources theHarvester supports
    # Rate limit of 5 requests per minute

    sources = __main__.Core.get_supportedengines()