Skip to content

Commit

Permalink
add more checker of bot
Browse files Browse the repository at this point in the history
  • Loading branch information
k1m0ch1 committed Mar 23, 2020
1 parent 1b23cd4 commit 260ee6d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime, timedelta
from flask import request
import re


TODAY = datetime.utcnow().date()
Expand All @@ -22,11 +23,12 @@ def is_empty(string):


def is_bot():
return request.headers.get('User-Agent') == 'gobot-covid19/2.0'
return request.headers.get('User-Agent') == 'Go-http-client/1.1' or \
request.headers.get('User-Agent') == 'gobot-covid19/2.0'


def is_not_bot():
return request.headers.get('User-Agent') != 'gobot-covid19/2.0'
return not request.headers.get('User-Agent') == 'gobot-covid19/2.0'


HOTLINE = [
Expand Down

0 comments on commit 260ee6d

Please sign in to comment.