Browse Source

Merge branch 'main' of gh:lcnetdev/scriptshifter

scossu 4 months ago
parent
commit
d19227da46
3 changed files with 15 additions and 1 deletions
  1. 1 0
      requirements.txt
  2. 1 1
      scriptshifter/hooks/hebrew/dicta_api.py
  3. 13 0
      scriptshifter/rest_api.py

+ 1 - 0
requirements.txt

@@ -1,4 +1,5 @@
 aksharamukha>=2.1,<2.2
+python-dotenv>=1.0,<2
 flask>=2.3,<2.4
 pyyaml>=6.0,<7
 uwsgi>=2.0,<2.1

+ 1 - 1
scriptshifter/hooks/hebrew/dicta_api.py

@@ -16,7 +16,7 @@ def s2r_post_config(ctx):
     ctx.warnings = []
     rsp = post(
             EP,
-            data={
+            json={
                 "data": ctx.src,
                 "genre": ctx.options.get("genre", DEFAULT_GENRE)
             })

+ 13 - 0
scriptshifter/rest_api.py

@@ -7,7 +7,11 @@ from os import environ, urandom
 
 from flask import Flask, jsonify, render_template, request
 
+<<<<<<< HEAD
 from scriptshifter.exceptions import ApiError
+=======
+# from scriptshifter.exceptions import ApiError
+>>>>>>> 7e9bbf5e0854f7fd8325abc809b17b50ff927038
 from scriptshifter.tables import list_tables, load_table
 from scriptshifter.trans import transliterate
 
@@ -32,6 +36,7 @@ def create_app():
 app = create_app()
 
 
+<<<<<<< HEAD
 @app.errorhandler(ApiError)
 def handle_exception(e: ApiError):
     rsp = e.get_response()
@@ -41,6 +46,14 @@ def handle_exception(e: ApiError):
     })
 
     return rsp
+=======
+#@app.exception_handler(ApiError)
+#def handle_exception(request: Request, e: ApiError):
+#    return JSONResponse(
+#        content=e.to_json(),
+#        status_code=e.status_code
+#    )
+>>>>>>> 7e9bbf5e0854f7fd8325abc809b17b50ff927038
 
 
 @app.route("/", methods=["GET"])