Jump to content

python mechanize


Recommended Posts

Obrigado amigo pela ajuda..

Para os próximos que tiverem a mesma duvida eu fiz da seguinte forma!

#criando uma variavel de arquivo e abrindo ele para escrita
cookiefile = open('./cookie.txt', 'w')
#variavel fazia para receber o resultado
cookie_string = ''

#varrendo todos os cookies do meu accesso com o mechanize
for c in br._ua_handlers['_cookies'].cookiejar:
  #buscando pelo cookie que eu precisava e se for a linha dele gravar no arquivo
  if 'Cookie que preciso' in c.name:
    cookiestr += c.name + '=' + c.value 
  • Vote 1
Link to comment
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
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.