Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ce46bdc

Browse files
code refactored
1 parent 4aa3329 commit ce46bdc

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

‎src/authentication/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from src.database.apikeys.keys import ApiKeyModel, sessions
1010

1111

12-
# TODO find a way to cache the results of this methods
1312
def authenticate_admin(func):
1413
@wraps(func)
1514
async def wrapper(*args, **kwargs):
@@ -34,14 +33,10 @@ def authenticate_app(func):
3433

3534
@wraps(func)
3635
async def wrapper(*args, **kwargs):
37-
# TODO find a way of authenticating APPS, not BASED on API, Suggestion SECRET_KEY
3836
request: Request = kwargs.get('request')
3937
if await verify_signature(request=request):
40-
print("Signature Verified")
4138
return await func(*args, **kwargs)
42-
4339
raise NotAuthorized(message="This Resource is only Accessible to Admins")
44-
4540
return wrapper
4641

4742

@@ -66,5 +61,4 @@ async def verify_signature(request):
6661
data_str, signature_header = request_header.split('|')
6762
_signature = hmac.new(secret_key.encode('utf-8'), data_str.encode('utf-8'), hashlib.sha256).hexdigest()
6863
result = hmac.compare_digest(_signature, signature_header)
69-
print(f"comparison result is {result}")
7064
return result

‎src/cloudflare_middleware/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"get_news_articles_by_date": "^/api/v1/news/articles-by-date/\d{4}-\d{2}-\d{2}(?<!/)$",
6464
"get_news_articles_by_publisher": "^/api/v1/news/articles-by-publisher/[a-zA-Z0-9_-]{2,128}(?<!/)$",
6565
"get_news_articles_by_ticker": "^/api/v1/news/articles-by-ticker/[a-zA-Z0-9_-]{1,16}(?<!/)$",
66+
"get_news_articles_by_page": "^/api/v1/news/articles-by-page/[1-9][0-9]?$",
6667
"get_stock_by_code": "^/api/v1/stock/code/[a-zA-Z0-9_-]{1,16}(?<!/)$",
6768
"get_stock_option": "^/api/v1/stocks/options/stock/[a-zA-Z0-9_-]{1,16}(?<!/)$",
6869
"get_update_delete_by_fundamental_id_company_details": "^/api/v1/fundamentals/company-details/id/[a-zA-Z0-9_-]{16}(?<!/)$",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /