Browse Source

Small issues resolved (#36)

* Fixed POST request

The POST request on line 142 had a variable "url", but this is undefined. Changed it to include the correct URL.

* Better Captcha Read

Added in rstrip to remove blank and newline characters at end of captcha. Sometimes the OCR would return new lines after the text, and this would never solve.
Chris S 2 years ago
parent
commit
3efc1947d0
1 changed files with 2 additions and 2 deletions
  1. 2 2
      domainhunter.py

+ 2 - 2
domainhunter.py

@@ -139,7 +139,7 @@ def checkBluecoat(domain):
                         response = s.get(url=captchasolutionURL,headers=headers,verify=False,proxies=proxies)
 
                         # Try the categorization request again
-                        response = s.post(url,headers=headers,json=postData,verify=False,proxies=proxies)
+                        response = s.post('https://sitereview.bluecoat.com/resource/lookup',headers=headers,json=postData,verify=False,proxies=proxies)
 
                         responseJSON = json.loads(response.text)
 
@@ -349,7 +349,7 @@ def solveCaptcha(url,session):
 
         # Perform basic OCR without additional image enhancement
         text = pytesseract.image_to_string(Image.open(jpeg))
-        text = text.replace(" ", "")
+        text = text.replace(" ", "").rstrip()
         
         # Remove CAPTCHA file
         try: