Marthee commited on
Commit
eda587d
·
verified ·
1 Parent(s): f79d675

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -51,22 +51,22 @@ def home():
51
  @app.route('/view-pdf', methods=['GET'])
52
  def download_pdf():
53
  # Parse and decode pdfLink safely
54
- # full_query_string = request.query_string.decode()
55
- # parsed_params = urllib.parse.parse_qs(full_query_string)
56
- # # print(parsed_params)
57
- # encoded_pdf_link = parsed_params.get('pdfLink', [None])[0]
58
- # # Get PDF link and keyword from finddata()
59
- # # pdf_link = finddata()
60
-
61
- # if not encoded_pdf_link:
62
- # return "Missing pdfLink parameter.", 400
63
-
64
- # # Decode the URL-encoded PDF link
65
- # pdf_link = urllib.parse.unquote(encoded_pdf_link)
66
- # print("Extracted PDF Link:", pdf_link)
67
- pdf_link = request.get_json()
68
- if not pdf_link:
69
- return "Missing pdfLink in request body.", 400
70
 
71
 
72
  try:
 
51
  @app.route('/view-pdf', methods=['GET'])
52
  def download_pdf():
53
  # Parse and decode pdfLink safely
54
+ full_query_string = request.query_string.decode()
55
+ parsed_params = urllib.parse.parse_qs(full_query_string)
56
+ # print(parsed_params)
57
+ encoded_pdf_link = parsed_params.get('pdfLink', [None])[0]
58
+ # Get PDF link and keyword from finddata()
59
+ # pdf_link = finddata()
60
+
61
+ if not encoded_pdf_link:
62
+ return "Missing pdfLink parameter.", 400
63
+
64
+ # Decode the URL-encoded PDF link
65
+ pdf_link = urllib.parse.unquote(encoded_pdf_link)
66
+ print("Extracted PDF Link:", pdf_link)
67
+ # pdf_link = request.get_json()
68
+ # if not pdf_link:
69
+ # return "Missing pdfLink in request body.", 400
70
 
71
 
72
  try: