Python 2/3 compatible, urllib module

pull/9/head
Thomas King 2016-03-18 08:47:30 +00:00
parent c73becee36
commit 9e8f81aafe
1 changed files with 3 additions and 2 deletions

View File

@ -8,11 +8,12 @@ import datetime
import os import os
import base64 import base64
import re import re
import urllib
try: try:
from urllib.parse import urljoin from urllib.parse import urljoin
from urllib.parse import quote
except ImportError: except ImportError:
from urllib import quote
from urlparse import urljoin from urlparse import urljoin
from io import BytesIO from io import BytesIO
import zipfile import zipfile
@ -681,7 +682,7 @@ class PyMISP(object):
return self._check_response(response) return self._check_response(response)
def search_index(self, value): def search_index(self, value):
value = urllib.quote(value) value = quote(value)
session = self.__prepare_session('json') session = self.__prepare_session('json')
url = urljoin(self.root_url, 'events/index/searchall:%s' % value) url = urljoin(self.root_url, 'events/index/searchall:%s' % value)
response = session.get(url) response = session.get(url)