Skip to content

Commit c234119

Browse files
Local time (#1)
* notifications logic * notifications logic * notifications logic
1 parent 047ae78 commit c234119

File tree

208 files changed

+1211
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+1211
-377
lines changed

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ RUN mkdir /code
1010
WORKDIR /code
1111
ADD requirements.txt /code/
1212
RUN pip install -r requirements.txt
13+
RUN pip install requests --ignore-installed
14+
RUN pip install requests[security]
1315
ADD . /code/
1416
CMD python scrader_server.py
15-
EXPOSE 8000
17+
EXPOSE 8000

algorithm.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pymongo import MongoClient
99
import logging
1010
import requests
11+
import string
1112

1213

1314
logger = logging.getLogger('newapp')
@@ -72,12 +73,12 @@ def store_to_database(data, coll):
7273
articles_stored += 1
7374
art_id = existing_articles.insert_one(new_article).inserted_id
7475

75-
if coll == 'articles':
76-
send_users_notification(
77-
scrader_db,
78-
article.get('Company'),
79-
art_id
80-
)
76+
# if coll == 'articles':
77+
# send_users_notification(
78+
# scrader_db,
79+
# article.get('Company'),
80+
# art_id
81+
# )
8182
logger.info('storing {} to database'.format(articles_stored))
8283

8384

@@ -111,6 +112,14 @@ def run_algorithm(filename):
111112
stop_words_list.extend(comp.get('synonims'))
112113

113114
data = pd.read_csv('./scraderdata.csv', sep=',', encoding='utf-8')
115+
116+
for k in range(len(data)):
117+
data["title"][k] = data["title"][k].lower()
118+
for i in range(len(data)):
119+
data["title"][i] = data["title"][i].encode('utf-8').translate(None, string.punctuation)
120+
for j in range(len(data)):
121+
data["title"][j] = ''.join([i for i in data["title"][j] if not i.isdigit()])
122+
114123
data1 = data['title']
115124
data2 = data['direction']
116125

0 commit comments

Comments
 (0)