diff --git a/moipy/moip.py b/moipy/moip.py index 4692846..27f1878 100644 --- a/moipy/moip.py +++ b/moipy/moip.py @@ -1,5 +1,6 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- + import base64 import pycurl @@ -89,12 +90,11 @@ def envia(self): resposta = RespostaMoIP() passwd = self.token + ":" + self.key - - passwd64 = base64.b64encode(passwd) + passwd64 = base64.b64encode(passwd.encode()) curl = pycurl.Curl() curl.setopt(pycurl.URL,self.url) - curl.setopt(pycurl.HTTPHEADER,["Authorization: Basic " + passwd64]) + curl.setopt(pycurl.HTTPHEADER,["Authorization: Basic " + passwd64.decode('UTF-8')]) curl.setopt(pycurl.USERAGENT,"Mozilla/4.0") curl.setopt(pycurl.USERPWD,passwd) curl.setopt(pycurl.POST,True) @@ -126,4 +126,4 @@ def __init__(self): def callback(self,buf): - self.conteudo = buf \ No newline at end of file + self.conteudo = buf