This file contains 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 kafka import KafkaProducer | |
import os | |
from datetime import datetime | |
import time | |
now = datetime.now() | |
bootstrap_servers = ['localhost:9092'] | |
topicName = 'Media' | |
producer = KafkaProducer(bootstrap_servers = bootstrap_servers) |
This file contains 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 kafka import KafkaConsumer | |
bootstrap_servers = ['localhost:9092'] | |
topicName = 'Media' | |
consumer = KafkaConsumer (topicName,bootstrap_servers = bootstrap_servers) | |
for message in consumer: | |
print(message) |
This file contains 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
# This is a comment | |
# Scalar is a single stored value | |
Name : Ashish # Scalar, string | |
Age : 20 # Scalar, int | |
Graduated : false # Scalar, boolean |
This file contains 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
kind : ConfigMap | |
application : | |
name : CRUD-operations | |
database : | |
connection-string : localhost | |
port : 27017 | |
username : YWRtaW4= | |
password : YWRtaW4xMjM= | |
database-name : College | |
collection-name : Student_Info |
This file contains 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 pymongo | |
import yaml | |
import base64 | |
class crud_operations: | |
def __init__(self): | |
print("Reading YAML file") | |
with open("config.yml", "r") as stream: |
This file contains 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 logging | |
import yaml | |
import os | |
from kafka import KafkaProducer | |
from datetime import datetime | |
class fileTransfer: | |
def __init__(self): | |
This file contains 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, render_template | |
from newsapi import NewsApiClient | |
app = Flask(__name__) | |
newsapi = NewsApiClient(api_key='****REPLACE_YOUR_API_KEY****') | |
@app.route('/') | |
@app.route('/home') | |
def home(): |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>NewsHub</title> | |
<link rel="stylesheet" href="../static/css/grid.css"> | |
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,300i,400,700" rel="stylesheet"> | |
<link rel="stylesheet" href="../static/css/home.css"> | |
<link rel="icon" href="../static/images/logo.png" type="image/jpg"> | |
</head> |
This file contains 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, jsonify,request | |
app = Flask(__name__) | |
app.config['SECRET_KEY']='XXXXXXX' | |
players =[ | |
{"Jersey Number": 10, | |
"Name" : "Sachin Tendulkar", | |
"Age" : 47, | |
"Role" : "Batsman", |
This file contains 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
# This is a sample Dockerfile | |
# set base image python:3.8-slim-buster | |
FROM python:3.8-slim-buster | |
# set working directory as app | |
WORKDIR /app | |
# copy requirements.txt file from local (source) to file structure of container (destination) | |
COPY requirements.txt requirements.txt |
OlderNewer