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 requests | |
import json | |
payload = {'Controller': 'Contact'} | |
r = requests.get('https://apps.net-results.com/api/v2/rpc/server.php', | |
# auth hidden after output | |
auth=('hidden', 'hidden'), params=payload) | |
r.status_code | |
print(r.url) |
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
# Personality + needs + values | |
'{"columns":["needs","personality","values"],"index":["2019-03-15 22:44:22","2019-03-17 19:01:42","2019-03-18 14:23:25","2019-03-20 13:51:11","2019-03-22 05:16:10","2019-03-23 20:14:20","2019-03-25 21:37:34","2019-03-27 00:05:10","2019-03-28 04:16:05","2019-03-29 22:32:46","2019-03-31 23:18:11","2019-04-02 04:44:32","2019-04-03 14:27:32","2019-04-04 16:51:49","2019-04-05 16:24:22"],"data":[[0.7151632238,0.6053568699,0.7248775326],[0.718530562,0.6318752601,0.7182858482],[0.7197990386,0.6091551122,0.7173640552],[0.7116060333,0.6150755899,0.712478925],[0.7279080433,0.6185500935,0.7216159622],[0.7313727202,0.6165556585,0.7352378107],[0.7192074244,0.5943037219,0.7110700616],[0.7188563191,0.5977294485,0.7035604222],[0.7229448873,0.6189199189,0.7116700079],[0.7077601643,0.6078923421,0.7128649776],[0.7103177746,0.6051451248,0.7171375702],[0.7033281227,0.6212052595,0.6998766858],[0.7035385536,0.621208091,0.6924056026],[0.7049898315,0.6240537599,0.6978764013],[0.7282550308,0.6161138956,0 |
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 imp | |
import sys | |
sys.modules["sqlite"] = imp.new_module("sqlite") | |
sys.modules["sqlite3.dbapi2"] = imp.new_module("sqlite.dbapi2") | |
from chalice import Chalice, Rate | |
from finviz.main_func import get_news | |
from newspaper import Article | |
import boto3 | |
import json |
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 chalice import Chalice | |
import boto3 | |
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer | |
import pandas as pd | |
from datetime import datetime | |
app = Chalice(app_name='Lambda2') | |
"""On SNS message from Lambda1, tranform data by dropping duplicates | |
and get sentiment""" |
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 chalice import Chalice | |
import boto3 | |
import json | |
import pandas as pd | |
from datetime import datetime | |
app = Chalice(app_name="Lambda3") | |
"""On SNS message from Lambda2, aggregate sentiment data and store it""" | |
@app.on_sns_message(topic='Lambda2Event') |
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 chalice import Chalice | |
import boto3 | |
import json | |
import pandas as pd | |
import numpy as np | |
app = Chalice(app_name="Lambda4") | |
"""API for serving aggregated data""" | |
@app.route("/") |
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 dash | |
from dash.dependencies import Input, Output | |
import dash_table | |
import dash_core_components as dcc | |
import dash_html_components as html | |
import dash_bootstrap_components as dbc | |
import plotly.figure_factory as ff | |
import pandas as pd | |
import scipy |
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
def scrape_urls(query, num): | |
""" | |
Takes a search query and returns links to websites of interest from google | |
""" | |
# Get urls from google search | |
urls = list(search(query, stop=num)) | |
# Trip advisor urls don't open properly so we omit them | |
urls = [url for url in urls if "tripadvisor" not in url] | |
return urls |
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 sentence_transformers import SentenceTransformer, util | |
from googlesearch import search | |
from newspaper import Article | |
from bertopic import BERTopic | |
from nltk import tokenize | |
from tqdm import tqdm | |
import nltk | |
import re | |
nltk.download('punkt') | |
nltk.download('stopwords') |
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
def get_sentences(url): | |
""" | |
Takes a url and outputs a list of sentences from the text of the website | |
""" | |
try: | |
article = Article(url) | |
article.download() | |
article.parse() | |
except: | |
pass |
OlderNewer