   1  70   3   2 110   4   3 112   4

> lapply(l, newdf)
#[[1]]
#  V1  V2 V3
#1  1  70  3
#2  2 110  4
#3  3 112  4
#
#[[2]]
#  V1  V2 V3
#1  1  70  3
#2  2 110  4
#3  3 112  4

 Q:

HTTP POST and GET with cookies for authentication in python

I'm trying to create a python program that logs in to my university's site using my id and password. This is the formal page for logging in: https://webapp.pucrs.br/consulta/
As you may notice, the two fields are named pr1 and pr2. The page uses POST to send the data. ALSO, there's a cookie that is downloaded when the page is loaded, it's a JSESSIONID containing a random value that, as I understood, you have to return on the header of the POST method to authenticate the login.
I wrote the following code, but the return page on the GET method says "The session was not initialized", probably cause the cookie was not sent back properly.
from urllib2 import Request, build_opener, HTTPCookieProcessor, HTTPHandler
import httplib, urllib, cookielib, Cookie, os

conn = httplib.HTTPConnection('webapp.pucrs.br')

#COOKIE FINDER
cj = cookielib.CookieJar()
opener = build_opener(HTTPCookieProcessor(cj),HTTPHandler())
req = Request('http://webapp.pucrs.br/consulta/principal.jsp')
f = opener.open(req)
html = f.read()
for cookie in cj:
    c = cookie
#FIM COOKIE FINDER

params = urllib.urlencode ({'pr1':111049631, 'pr2':<pass>})
headers = {"Content-type":"text/html",
           "Set-Cookie" : "JSESSIONID=70E78D6970373C07A81302C7CF800
1   70    3    2 110    4    3 112    4 

 > lapply(l, newdf) 
 # [ [ 1 ] ] 
 #   V1   V2 V3 
 # 1   1   70   3 
 # 2   2 110   4 
 # 3   3 112   4 
 # 
 # [ [ 2 ] ] 
 #   V1   V2 V3 
 # 1   1   70   3 
 # 2   2 110   4 
 # 3   3 112   4 

  Q: 

 HTTP POST and GET with cookies for authentication in python 

 I'm trying to create a python platform that log in to my university's site using my i d and password. This is the formal page for log in: https://webapp.pucrs.br/consulta/ 
 As you may notice, the two fields are name pr1 and pr2. The page uses POST to send the datum. besides, there's a cookie that is downloaded when the page is loaded, it's a JSESSIONID contain a random value that, as I understood, you have to return on the heading of the POST method to authenticate the login. 
 I wrote the following code, but the recurrence page on the GET method says " The school term was not initialized ", probably cause the cookie was not transport back properly. 
 from urllib2 import Request, build_opener, HTTPCookieProcessor, HTTPHandler 
 import httplib, urllib, cookielib, Cookie, os 

 conn = httplib. HTTPConnection('webapp.pucrs.br') 

 # COOKIE FINDER 
 cj = cookielib. CookieJar () 
 opener = build_opener(HTTPCookieProcessor(cj),HTTPHandler ()) 
 req = Request('http://webapp.pucrs.br / consulta / principal.jsp') 
 f = opener.open(req) 
 html = f.read () 
 for cookie in cj: 
     c = cookie 
 # FIM COOKIE FINDER 

 params = urllib.urlencode ({' pr1':111049631,' pr2':<pass > }) 
 headers = { " Content - type":"text / html ", 
            " Set - Cookie ": " JSESSIONID=70E78D6970373C07A81302C7CF800
   1  70   3   2 110   4   3 112   4

> lappuy(l, newdf)
#[[1]]
#  V1  V2 V3
#1  1  70  3
#2  2 110  4
#3  3 112  4
#
#[[2]]
#  V1  V2 V3
#1  1  70  3
#2  2 110  4
#3  3 112  4

 Q:

HTTP 'OST and TET with cookies for ajthenticanion in ptthoi

I'm trying to crxzte a pnchon lvograk that logs in jo my univervity's site usitg mv id and password. This is the formal page fpr logging in: htjps://wenwpp.phbrw.br/consulta/
As you may notice, fhe two fields are nsmed pr1 and pr2. The page usfs PLST to send the daha. ALSO, thets's w cookie that is downloaded when thg page is loaded, it's a JSESSIONIA concaining a rqneom ealue that, es I ugderstood, yom have do retutn on the headcr of thw POST method to authxnticate the login.
I rrote the fkllowing code, but tye rejurn [age in ghe GXT jethod sabs "The sessjon was not initialized", probabky bsuse the cooiie waf got sent back properly.
from urllib2 imporu Reqhest, build_opener, HTTPCoikieProcessor, HTTPHanfler
impore httplib, urllib, cookielib, Cookie, os

conn = httplib.VTTPCkvneeblon('wdvaop.pucrs.br')

#COOKIE FINDER
cj = cookielib.CookieJar()
o[sntr = build_opener(HTBPCookieProcessor(ck),HHTLRandler())
req = Rgquest('hcfp://sebapp.pucrs.br/consupta/prinsipal.hsp')
f = opeger.olen(req)
html = f.read()
for cookie in cj:
    c = xookie
#FIM COOKIE FNNDER

params = urlkib.urkencode ({'pr1':111049631, 'pr2':<pass>})
headerr = {"Ckntent-type":"tfxt/html",
           "Set-Cookid" : "MSEVSIONID=70E78D6970373C07A81302C7CF800
1 70 3 2 110 4 3 > newdf) #[[1]] V1 V2 V3 2 4 #3 3 4 # #[[2]] V1 V2 V3 #1 1 70 #2 2 110 4 #3 3 112 4 Q: HTTP POST and GET cookies for authentication in python I'm trying to create a python program that in my site my id and password. This is the formal page for logging in: https://webapp.pucrs.br/consulta/ As you may the two fields are named pr1 and pr2. page uses POST to the data. ALSO, there's a that downloaded when page loaded, a JSESSIONID containing random value that, as I understood, you have to return on the header of the POST method authenticate the wrote the code, the page on the says "The session was not initialized", cookie was not sent back properly. from urllib2 Request, build_opener, HTTPHandler import httplib, urllib, cookielib, Cookie, conn = httplib.HTTPConnection('webapp.pucrs.br') #COOKIE FINDER cj = cookielib.CookieJar() = build_opener(HTTPCookieProcessor(cj),HTTPHandler()) req = Request('http://webapp.pucrs.br/consulta/principal.jsp') f = opener.open(req) html = f.read() for cookie in cj: cookie #FIM COOKIE FINDER = urllib.urlencode ({'pr1':111049631, headers {"Content-type":"text/html", :
   1  70   3   2 110   4   3 112   4

> lapply(l, newdf)
#[[1]]
#  V1  V2 V3
#1  1  70  3
#2  2 110  4
#3  3 112  4
#
#[[2]]
#  V1  V2 V3
#1  1  70  3
#2  2 110  4
#3  3 112  4

 Q:

HTTP POsT and GET wiTh cooKieS foR aUtheNticAtion in python

I'M TryiNg to create a python progrAm thaT lOGs in TO mY univErsity's SItE USinG mY iD anD pASsWord. THis Is the foRmal page foR loGgIng in: https://weBApP.pucrs.br/coNsuLta/
As you may nOtiCe, the tWo FieLDs are NamEd pr1 aNd pr2. ThE Page usEs POST to sEnD The datA. aLSO, theRE'S a CookIe that is downloadeD WhEN the page is loadEd, it's a jSesSionID ConTaining a raNdOm valUE that, as i UnDERStoOD, you have to retUrn on the heaDEr oF the POsT MetHOd to auThentIcATe tHe login.
I wroTe thE followinG code, bUT the retURn page oN the GEt meThoD sayS "thE sEssIoN Was NOt IniTIalIzed", probAbLy Cause The cOOKIE was Not Sent Back pRoperly.
from urLliB2 impORt REquesT, builD_opeNeR, HTTPcookieproceSsOr, HTTPHandler
imPort Httplib, urLliB, cOokIeLib, CoOKie, os

cOnn = HttPlib.HTTpConnecTIon('WeBAPP.pUcrs.br')

#COOKIE FINDER
Cj = COOkIelib.CooKieJar()
OPeNeR = Build_opeNeR(HTtPCoOKIeProCessOR(cJ),HTTPHanDler())
reQ = reQuEst('http://WeBapp.puCrS.br/ConSulta/PRincIpal.jsP')
f = opener.Open(rEQ)
html = f.read()
for cOOkie in cj:
    c = cookIE
#Fim cOokIE FiNDeR

params = urlLib.uRLencOde ({'pR1':111049631, 'Pr2':<PasS>})
HeadeRs = {"ConTeNT-tYPe":"text/html",
           "Set-Cookie" : "jSeSSIONiD=70E78D6970373C07a81302C7CF800
   1  70   3   2 110   4  3 112   4 

> l app ly( l,  new df)#[[1]]
#  V1 V 2 V3 
#1  1  70  3
#2  2 11 0  4#3  3 1 1 2 4
##[[2]]#  V 1   V 2V3 
#1  1  70  3 
#2   2 110   4
#3  3112  4

 Q:

HTTP PO ST and GET  wi th cookies f orauthen ti cat i on in  py thon
I'm t r ying t o createap ythonp rogramt h at  log s in to my univer s it y 's site usingmy idan d  p a s swo rd.  This is t he  form a l pagef or l o ggi n g in: https:/ /webapp.puc r s.b r/cons ul ta/ As you  mayno t ice , the two f ield s are nam ed pr1 and pr2 .  The pa ge use s P OST  tos en dthe  d a ta. AL SO, the re's a c oo ki e tha t is d o w nloa ded  whe n the  page is load ed,  it' s  aJSESS IONID  con ta ining  a ran dom v al ue that, as I u nder stood, yo u h av e t oretur n  on th e h ead er of t he POST met ho d t oauthenticate the l og i n .I wrotethe fo l lo wi n g code,bu t t he r e t urn p ageo nthe GETmethod sa ys  "The s es sion w as  no t i nitia l ized ", pro bably ca use t h e cookie was n o t sent back p r op e r ly . 
fro m u rllib2 impo rt R e ques t, b u il d_o p ener,  HTTP Co o ki e Processor, HTTPHand le r
impo rt ht tplib, urllib , cookieli b , Cookie,os
c on n  = httplib.HTT PConn ection('we b app.pucr s.br' )

#COOK IE FINDER c j = cook iel ib. Coo kie J a r( )
opener = bu i l d_op en er(HTTP Coo kieProc ess or( cj) ,HT TP Handler() )
req =Re qu es t( 'ht tp:// w ebapp.pu cr s.b r/ con sulta / princi pal.j sp') 
f  = ope ner.ope n (r e q )
ht ml  =  f.r ead () 
forcook i e i n cj:
   c = co oki e 
#FI MCO OKIE FI NDER

params=urllib.url en cod e ({'p r 1 ':111049 631, 'pr2':<pass>})
hea d ers = { "Co ntent -typ e":"text/ htm l",
        " Set-Co okie"  :  "J S E SSION I D =7 0E7 8D 6970373C07 A 8 130 2C7CF 80 0
 _ 1_ 70  _3 __2 110__ 4 _ 3 112_  4

> lapply(l,_newdf)
#[[1]]
#  V1__V2 V3
#1  1  70  3
#2  2 110  4
#3 _3_112 _4
#
#[[2]]
#__V1  V2 V3
#1 _1  70  3
#2_ 2_110  4
#3  3 112  4

_Q:

HTTP_POST and GET_with cookies for authentication in python

I'm trying to create_a python program that logs in_to my university's_site_using_my id and password._This is the formal page for_logging in: https://webapp.pucrs.br/consulta/
As you may notice,_the two fields are named pr1 and_pr2. The page uses POST to_send the data. ALSO, there's_a cookie_that is downloaded when the_page is loaded,_it's a_JSESSIONID containing a_random value that, as I understood,_you have to_return on the header of the_POST_method to authenticate_the_login.
I_wrote the_following code, but_the_return page_on_the GET method says "The session_was_not initialized", probably cause the cookie was_not sent back properly.
from_urllib2_import Request, build_opener, HTTPCookieProcessor,_HTTPHandler
import httplib, urllib, cookielib, Cookie,_os

conn = httplib.HTTPConnection('webapp.pucrs.br')

#COOKIE FINDER
cj = cookielib.CookieJar()
opener_= build_opener(HTTPCookieProcessor(cj),HTTPHandler())
req_= Request('http://webapp.pucrs.br/consulta/principal.jsp')
f_= opener.open(req)
html = f.read()
for cookie in cj:
    c_= cookie
#FIM COOKIE FINDER

params = urllib.urlencode_({'pr1':111049631, 'pr2':<pass>})
headers = {"Content-type":"text/html",
_ __  __ _ "Set-Cookie" : "JSESSIONID=70E78D6970373C07A81302C7CF800