(row)
| 12 | |
| 13 | |
| 14 | def hit_api_request(row): |
| 15 | |
| 16 | try: |
| 17 | response = httpx.post( |
| 18 | "http://localhost:5000/api/deeppass2", |
| 19 | data = row["document"], |
| 20 | headers={"Content-Type": "text/plain; charset=utf-8"}, |
| 21 | ) |
| 22 | |
| 23 | if response.status_code == 200: |
| 24 | json_response = response.json() |
| 25 | print(json_response) |
| 26 | try: |
| 27 | row["BERT"] = json_response["Success"][1]["BERT_secrets"][0]["secret"] |
| 28 | |
| 29 | except Exception as e: |
| 30 | row["BERT"] = ["No Secret"] |
| 31 | |
| 32 | |
| 33 | try: |
| 34 | row["LLM"] = json_response["Success"][2]["LLM_scanning"][0]["Extracted_Credentials"] |
| 35 | except Exception as e: |
| 36 | row["LLM"] = ["No Secret"] |
| 37 | |
| 38 | else: |
| 39 | row["LLM"] = ["API-FAIL"] |
| 40 | row["BERT"] = ["API-FAIL"] |
| 41 | except Exception as e: |
| 42 | row["LLM"] = ["API-TIMED-OUT"] |
| 43 | row["BERT"] = ["API-TIMED-OUT"] |
| 44 | print(e) |
| 45 | |
| 46 | return row |
| 47 | |
| 48 | |
| 49 | def _string_overlap_ratio(s1, s2, min_ratio=0.5): |
nothing calls this directly
no outgoing calls
no test coverage detected