This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def check_if_index_is_present(url): | |
response = requests.request("GET", url, data="") | |
json_data = json.loads(response.text) | |
return json_data | |
if __name__ == "__main__": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
from bs4 import BeautifulSoup | |
import requests,json,time | |
from random import randint | |
if __name__ == "__main__": | |
count = 1 | |
website = "https://hackr.io/" | |
html_content = urlopen(website) | |
soup_data = BeautifulSoup(html_content, 'lxml') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Blueprint,render_template,request,jsonify | |
import requests,json | |
# creating a Blueprint class | |
search_blueprint = Blueprint('search',__name__,template_folder="templates") | |
search_term = "" | |
headers = { | |
'Content-Type': "application/json", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from routes.search import search_blueprint | |
app = Flask(__name__) | |
app.register_blueprint(search_blueprint) | |
if __name__ == "__main__": | |
app.run("0.0.0.0",port=8005,debug=False,threaded=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind = "0.0.0.0:8005" | |
workers = 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here we are creating an image for python alphine image.(https://hub.docker.com/r/library/python/) | |
FROM python:3 | |
# Copying the requirements.txt first to leverage Docker cache | |
COPY ./requirements.txt /app/requirements.txt | |
# WORKDIR is nothing but current directory (cd app) | |
WORKDIR /app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo: required | |
services: | |
- docker | |
before_install: | |
- docker build -t dineshsonachalam/hacker:1.0.0 . | |
script: | |
#log in to docker CLI | |
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete the possibly existing autocomplete test index | |
curl -X DELETE localhost:9200/autocomplete_test | |
# Put the config of the autocomplete index | |
curl -X PUT localhost:9200/autocomplete_test -d ' | |
{ | |
"settings" : { | |
"index" : { | |
"analysis" : { | |
"analyzer" : { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 4; | |
events { worker_connections 1024; } | |
http { | |
sendfile on; | |
upstream app_hacker { | |
server hacker:8005; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
elasticsearch: | |
image: "elasticsearch:5" | |
networks: | |
- frontend | |
restart: always | |
volumes: | |
- ./ES_DATA:/usr/share/elasticsearch/data | |
environment: |