mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-12-22 19:55:12 +00:00
BETTERZON-58: Adding access key verification
This commit is contained in:
parent
c8d37d60f8
commit
73effffc89
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
|
||||
from flask import Flask
|
||||
from flask_restful import Resource, Api, reqparse
|
||||
|
||||
|
@ -19,8 +21,12 @@ class CrawlerApi(Resource):
|
|||
def post(self):
|
||||
# Accept crawler request here
|
||||
args = parser.parse_args()
|
||||
access_key = os.getenv('CRAWLER_ACCESS_KEY')
|
||||
if(args['key'] == access_key):
|
||||
crawler.crawl(args['products'])
|
||||
return args
|
||||
return {'message': 'success'}
|
||||
else:
|
||||
return {'message': 'Wrong access key'}
|
||||
|
||||
|
||||
api.add_resource(CrawlerApi, '/')
|
||||
|
|
Loading…
Reference in New Issue
Block a user