Jahar Posted August 19, 2020 Author Posted August 19, 2020 @TheXman Both are getting error 11. I checked with other gmail account after signing out and re logging with new one. Same error coming thru code, but with atom url manually, it works
TheXman Posted August 19, 2020 Posted August 19, 2020 (edited) Let's try a different method. Make sure that you update the $USERNAME & $PASSWORD constants with the correct values. expandcollapse popup#include <Constants.au3> test() Func test() ;Put your USERNAME and PASSWORD below Const $USERNAME = "username", _ $PASSWORD = "password" Local $oComErr = ObjEvent("AutoIt.Error", com_error_handler) With ObjCreate("winhttp.winhttprequest.5.1") ;Set up and send request .Open("GET", "https://mail.google.com/mail/feed/atom", False) .SetCredentials($USERNAME, $PASSWORD, 0) .Send() If .Status <> 200 Then Exit MsgBox($MB_ICONWARNING, "WARNING", _ "BAD HTTP RESPONSE" & @CRLF & @CRLF & .Status & " " & .StatusText) ;Display response ConsoleWrite(StringLeft(.ResponseText, 200) & @CRLF) ;First 200 bytes of response EndWith EndFunc Func com_error_handler($oComErr) Local $sErrMsg With $oComErr $sErrMsg = @CRLF $sErrMsg &= ">>> COM ERROR <<<" & @CRLF $sErrMsg &= StringFormat("Script Line Number : %s", .ScriptLine) & @CRLF $sErrMsg &= StringFormat("HRESULT : 0x%x (%s)", .Number, .Number) & @CRLF $sErrMsg &= StringFormat("Windows Error : %s", StringStripWS(.WinDescription, $STR_STRIPTRAILING)) & @CRLF $sErrMsg &= StringFormat("Object Description : %s", StringStripWS(.Description, $STR_STRIPTRAILING)) & @CRLF $sErrMsg &= StringFormat("GetLastError() : %s", .LastDllError) & @CRLF EndWith ConsoleWrite($sErrMsg) MsgBox($MB_ICONERROR, "ERROR", $sErrMsg) Exit EndFunc Edited August 20, 2020 by TheXman Slightly modified the script CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Jahar Posted August 20, 2020 Author Posted August 20, 2020 (edited) @thexman I tried the above code and ended with a message "BAD HTTP RESPONSE : 401 Unauthorized" - at the same time manually atom url is working. The surprise is I got a mail from google security alert that "Someone just used your password to try to sign in to your account from a non-Google app. Google blocked them, but you should check what happened. Review your account activity to make sure no one else has access." What should I do to solve this? Edited August 20, 2020 by Jahar Add extra information
Jahar Posted August 20, 2020 Author Posted August 20, 2020 @TheXman I changed google settings to allow less secure apps and it worked well with your last code. Now let me try with old codes. Thanks
TheXman Posted August 20, 2020 Posted August 20, 2020 (edited) 3 minutes ago, Jahar said: I changed google settings to allow less secure apps and it worked well with your last code. Since it worked with your browser, I was going to suggest trying to use a valid browser User-Agent before lowering the Google security setting. But if that works for you, great! Edited August 20, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Jahar Posted August 20, 2020 Author Posted August 20, 2020 @TheXman The unfortunate thing is the other codes are still throwing error. Hope the last one will work in all machine.
Jahar Posted August 21, 2020 Author Posted August 21, 2020 @TheXman I have an issue with response text received with the code. I am having a mail with subject "You've received" - but response text gives "You've received " . Please help me to solve this. expandcollapse popup#include <Constants.au3> test() Func test() ;Put your USERNAME and PASSWORD below Const $USERNAME = "username", _ $PASSWORD = "password" Local $oComErr = ObjEvent("AutoIt.Error", com_error_handler) With ObjCreate("winhttp.winhttprequest.5.1") ;Set up and send request .Open("GET", "https://mail.google.com/mail/feed/atom", False) .SetCredentials($USERNAME, $PASSWORD, 0) .Send() If .Status <> 200 Then Exit MsgBox($MB_ICONWARNING, "WARNING", _ "BAD HTTP RESPONSE" & @CRLF & @CRLF & .Status & " " & .StatusText) ;Display response ConsoleWrite(StringLeft(.ResponseText, 200) & @CRLF) ;First 200 bytes of response EndWith EndFunc Func com_error_handler($oComErr) Local $sErrMsg With $oComErr $sErrMsg = @CRLF $sErrMsg &= ">>> COM ERROR <<<" & @CRLF $sErrMsg &= StringFormat("Script Line Number : %s", .ScriptLine) & @CRLF $sErrMsg &= StringFormat("HRESULT : 0x%x (%s)", .Number, .Number) & @CRLF $sErrMsg &= StringFormat("Windows Error : %s", StringStripWS(.WinDescription, $STR_STRIPTRAILING)) & @CRLF $sErrMsg &= StringFormat("Object Description : %s", StringStripWS(.Description, $STR_STRIPTRAILING)) & @CRLF $sErrMsg &= StringFormat("GetLastError() : %s", .LastDllError) & @CRLF EndWith ConsoleWrite($sErrMsg) MsgBox($MB_ICONERROR, "ERROR", $sErrMsg) Exit EndFunc
Jahar Posted August 21, 2020 Author Posted August 21, 2020 I have an issue with response text received with the code. I am having a mail with subject "You've received" - but response text gives "You've received " . Please help me to solve this. expandcollapse popup#include <Constants.au3> test() Func test() ;Put your USERNAME and PASSWORD below Const $USERNAME = "username", _ $PASSWORD = "password" Local $oComErr = ObjEvent("AutoIt.Error", com_error_handler) With ObjCreate("winhttp.winhttprequest.5.1") ;Set up and send request .Open("GET", "https://mail.google.com/mail/feed/atom", False) .SetCredentials($USERNAME, $PASSWORD, 0) .Send() If .Status <> 200 Then Exit MsgBox($MB_ICONWARNING, "WARNING", _ "BAD HTTP RESPONSE" & @CRLF & @CRLF & .Status & " " & .StatusText) ;Display response ConsoleWrite(StringLeft(.ResponseText, 200) & @CRLF) ;First 200 bytes of response EndWith EndFunc Func com_error_handler($oComErr) Local $sErrMsg With $oComErr $sErrMsg = @CRLF $sErrMsg &= ">>> COM ERROR <<<" & @CRLF $sErrMsg &= StringFormat("Script Line Number : %s", .ScriptLine) & @CRLF $sErrMsg &= StringFormat("HRESULT : 0x%x (%s)", .Number, .Number) & @CRLF $sErrMsg &= StringFormat("Windows Error : %s", StringStripWS(.WinDescription, $STR_STRIPTRAILING)) & @CRLF $sErrMsg &= StringFormat("Object Description : %s", StringStripWS(.Description, $STR_STRIPTRAILING)) & @CRLF $sErrMsg &= StringFormat("GetLastError() : %s", .LastDllError) & @CRLF EndWith ConsoleWrite($sErrMsg) MsgBox($MB_ICONERROR, "ERROR", $sErrMsg) Exit EndFunc
Danp2 Posted August 21, 2020 Posted August 21, 2020 That's standard HTML encoding. Lots of examples on the forum if you use the search feature. Latest Webdriver UDF Release Webdriver Wiki FAQs
TheXman Posted August 21, 2020 Posted August 21, 2020 (edited) Why did you start another topic with the exact same question? Edited August 21, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Moderators JLogan3o13 Posted August 21, 2020 Moderators Posted August 21, 2020 @Jahar please stick to one topic. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Jahar Posted August 21, 2020 Author Posted August 21, 2020 @TheXman @JLogan3o13 Sorry for dupilcate post. I did so as none gave me reply. Wont repeat this in future. Please help me to resolve the above issue
Moderators JLogan3o13 Posted August 21, 2020 Moderators Posted August 21, 2020 You need to show some patience. Just because this is the most important thing in the world to you does not mean you just spam the forum until you get an answer. Forum etiquette is to wait 24 hours before bumping your thread. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
TheXman Posted August 21, 2020 Posted August 21, 2020 (edited) The advice you were given a year ago is still true today. Please stop @ tagging me. I am done trying to help you until you start actually "showing" some of your own efforts. Don't show me my unmodified code that I provided to help you and ask for additional code because it does not do exactly what you need it to do. What have you done to try to resolve your issue? Show me your code (or a representative example) that you have modified or created yourself and ask specific questions about issues or obstacles that you are encountering. Edited August 22, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
TheXman Posted August 22, 2020 Posted August 22, 2020 It was a pleasure! I look forward to doing it again. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Jahar Posted August 22, 2020 Author Posted August 22, 2020 But i am not a sadist in finding pleasure like you
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now