Skip to content

Commit

Permalink
feat: Added /my/username endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan committed Oct 23, 2024
1 parent 239733f commit e3eb477
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions upsonic_on_prem/api/endpoints/my_username/endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# API Informations
from upsonic_on_prem.api.endpoints.utils import get_current_directory_name
from upsonic_on_prem.api.app import app
from flask import jsonify, request

import requests
import traceback


url = get_current_directory_name()
name_of_endpoint = url.replace("/", "_")
auth = "user"
scope_write_auth = False
scope_read_auth = False
method = "GET"
#



from upsonic_on_prem.__init__ import __version__

def endpoint():
""" """
try:
result = requests.post("http://localhost:3001/get_username_of_ak", data={"access_key":request.authorization.password}).json()["result"]
except:
traceback.print_exc()
result = "Error"

return jsonify(
{
"status": True,
"result": result,
}
)


endpoint.__name__ = name_of_endpoint
app.route(url, methods=[method])(endpoint)

0 comments on commit e3eb477

Please sign in to comment.