Jump to content
nill

What's wrong with the link, I can’t download it via autoit

Recommended Posts

Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", 'https://api.reg.ru/api/regru2/zone/clear', False)
$oHTTP.Send()

I load this link and get an error, although the same code and any other link are loaded without an error, what is wrong with the link?

 

Share this post


Link to post
Share on other sites
Posted (edited)

first step is to add error handling to your script. for objects, that would be "COM error handler", you can simply copy it from the help file example for ObjEvent(), like so:

Local $oError = ObjEvent("AutoIt.Error", "_ErrFunc")



Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", 'https://api.reg.ru/api/regru2/zone/clear', False)
$oHTTP.Send()



Func _ErrFunc()
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

run your code and look at the console output. continue investigating from there.

 

 

Edited by orbs

Share this post


Link to post
Share on other sites

err.number is:         0x80020009
    err.windescription:    Ошибка.

    err.description is:     Для проверки подлинности клиента требуется сертификат

    err.source is:         WinHttp.WinHttpRequest
    err.helpfile is:     
    err.helpcontext is:     0
    err.lastdllerror is:     0
    err.scriptline is:     7
    err.retcode is:     0x80072F0C

 

translate err.description is: Client authentication certificate required

 

What I can do with this?

Share this post


Link to post
Share on other sites
Posted (edited)

This means you probably need some sort of Token in a cookie for authentication  (oAuth or similar) which you haven't done first. When you use the  browser, does it require to login at some stage? 

Jos  

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

if you just download the link without login, it will give an answer in json format
As I understand it, the answer should be without a login

 

this is what i get in brouser without login

{
   "charset" : "utf-8",
   "error_code" : "NO_AUTH",
   "error_params" : {
      "command_name" : "zone/clear"
   },
   "error_text" : "No authorization mechanism selected",
   "messagestore" : null,
   "result" : "error"
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...