안녕하세요... post방식으로 인자값을 주고 로그인을 한후,
특정페이지 넘어가는 스크립트를 실행했는데 로그인이 안돼는거 같아 답답한 마음에 질문드립니다... 네이버 로그인하는부분에서 파라미터와 파리미터값을 틀리게 넣어도 아래 로그를 보시다시피 response 리턴값은 200이라는 기이한 현상이 나옵니다.. 어디가 잘못돼었고 어디를 고쳐야 하나요? 로그인이 안돼니 메일함에도 못가는 에러로그도 나옵니다 아래의 소스를 보시고 알려주시면 감사하겠습니다 ( __) +++++++++++소스 # _*_ coding: utf8 _*_ from HTTPClient import NVPair, Cookie, CookieModule, CookiePolicyHandler from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest from net.grinder.script import Test from net.grinder.script.Grinder import grinder from java.util import Date # Set up a cookie handler to log all cookies that are sent and received. class MyCookiePolicyHandler(CookiePolicyHandler): def acceptCookie(self, cookie, request, response): return 1 def sendCookie(self, cookie, request): return 1 CookieModule.setCookiePolicyHandler(MyCookiePolicyHandler()) test1 = Test(1, "checkout home") request1 = test1.wrap(HTTPRequest(url="https://www.naver.com")) class TestRunner: def __init__(self): # Login URL request = HTTPRequest(url="https://nid.naver.com/nidlogin.login") ##### reset to the all cookies ##### threadContext = HTTPPluginControl.getThreadHTTPClientContext() self.cookies = CookieModule.listAllCookies(threadContext) for c in self.cookies: CookieModule.removeCookie(c, threadContext) # do login 로그인 resp = request.POST("https://nid.naver.com/nidlogin.login", ( NVPair('useri', 'admi'), NVPair('userp', '!@#$@'))); print '---------',resp.statusCode ##### save to the login info in cookies ##### self.cookies = CookieModule.listAllCookies(threadContext) def __call__(self): grinder.statistics.delayReports = 1 ##### Set to the cookies for login ##### threadContext = HTTPPluginControl.getThreadHTTPClientContext() for c in self.cookies: CookieModule.addCookie(c,threadContext) ##### Request with login ##### #### 메인페이지 이동 result = request1.GET("https://mail.naver.com/?n=1469669272211&v=f") #### 메인페이지 정상이동을 html 화면으로 저장후 확인 text = result.getText() if isinstance(text, unicode) : text = text.encode('utf-8') writeToFile(text) if result.text.count("only my content data") < 0: grinder.statistics.forLastTest.success = 0 else : grinder.statistics.forLastTest.success = 1 def writeToFile(text): filename = "%s-page-%d.html" % (grinder.processName, grinder.runNumber) file = open(filename, "w") print >> file, text file.close() +++++++++++로그 2016-07-28 10:28:16,214 INFO mobigen_nella-17 thread-0: https://nid.naver.com/nidlogin.login -> 200 OK, 16249 bytes 2016-07-28 10:28:16,214 INFO mobigen_nella-17 thread-0: starting, will do 5 runs 2016-07-28 10:28:16,214 INFO mobigen_nella-17 : start time is 1469669296221 ms since Epoch 2016-07-28 10:28:16,308 INFO mobigen_nella-17 thread-0 [ run-0, test-1 ]: https://mail.naver.com/?n=1469669272211&v=f -> 302 Found, 0 bytes [Redirect, ensure the next URL is https://mail.naver.com/login?url=https%3A%2F%2Fmail.naver.com%2F%3Fn%3D1469669272211%26v%3Df] 2016-07-28 10:28:16,401 INFO mobigen_nella-17 thread-0 [ run-1, test-1 ]: https://mail.naver.com/?n=1469669272211&v=f -> 302 Found, 0 bytes [Redirect, ensure the next URL is https://mail.naver.com/login?url=https%3A%2F%2Fmail.naver.com%2F%3Fn%3D1469669272211%26v%3Df] 2016-07-28 10:28:16,480 INFO mobigen_nella-17 thread-0 [ run-2, test-1 ]: https://mail.naver.com/?n=1469669272211&v=f -> 302 Found, 0 bytes [Redirect, ensure the next URL is https://mail.naver.com/login?url=https%3A%2F%2Fmail.naver.com%2F%3Fn%3D1469669272211%26v%3Df] 2016-07-28 10:28:16,558 INFO mobigen_nella-17 thread-0 [ run-3, test-1 ]: https://mail.naver.com/?n=1469669272211&v=f -> 302 Found, 0 bytes [Redirect, ensure the next URL is https://mail.naver.com/login?url=https%3A%2F%2Fmail.naver.com%2F%3Fn%3D1469669272211%26v%3Df] 2016-07-28 10:28:16,636 INFO mobigen_nella-17 thread-0 [ run-4, test-1 ]: https://mail.naver.com/?n=1469669272211&v=f -> 302 Found, 0 bytes [Redirect, ensure the next URL is https://mail.naver.com/login?url=https%3A%2F%2Fmail.naver.com%2F%3Fn%3D1469669272211%26v%3Df] |
안녕하세요.
동일한 질문이여서 윗글에 같이 답변 드렸습니다. 윗 게시글 참고 하시면 될듯 합니다. 감사합니다. |
Free forum by Nabble | Edit this page |