jeudi 12 janvier 2017

can close url in python?

when i want to open url from urllib in python for moe than one time some eror come. my code(some part)

    while(key==1):
    #start send url2
    parms = urllib.urlencode({
        'username' : 'user',
        'password' : 'pass1',
        'submit' : 'hackk' 
        })
    weburl3=urllib.urlopen(weburl3,parms)
    #finish send url2
    data=weburl3.geturl()

the error :

  File "roozbehschool_ir.py", line 21, in <module>
  weburl3=urllib.urlopen(weburl3,parms)
  File "F:\python\data\lib\urllib.py", line 89, in urlopen
  return opener.open(url, data)
  File "F:\python\data\lib\urllib.py", line 185, in open
  fullurl = unwrap(toBytes(fullurl))
  File "F:\python\data\lib\urllib.py", line 1071, in unwrap
  url = url.strip()
  AttributeError: addinfourl instance has no attribute 'strip'

can i close url??




Aucun commentaire:

Enregistrer un commentaire