import urllib.request
import urllib.parse
import urllib.error
import urllib.response


class CPyCurl:
    def __init__(self, url, params):
        self.Url = url
        if params is not None:
            self.Data = urllib.parse.urlencode(params).encode('utf-8')
        else:
            self.Data = ""

    def do_request(self, headers):
        try:
            if self.Data == "":
                query = urllib.request.Request(self.Url)
            else:
                query = urllib.request.Request(self.Url, self.Data)
            if headers is not None:
                for i in headers:
                    query.add_header(i, headers[i])
            return urllib.request.urlopen(query).read()
        except urllib.error.URLError as er:
            print(er.reason)

@@ -1,22 +1,29 @@
-import
+try:%0A    from
  urllib.request%0A
@@ -21,24 +21,35 @@
 .request
-%0A
+ 
 import 
+*%0A    from 
 urllib.p
@@ -52,24 +52,35 @@
 ib.parse
-%0A
+ 
 import 
+*%0A    from 
 urllib.e
@@ -87,16 +87,27 @@
 rror
-%0A
+ 
 import 
+*%0A    from 
 urll
@@ -117,16 +117,77 @@
 response
+ import *%0Aexcept:%0A    from urllib2 import *%0A    import urllib
 %0A%0A%0Aclass
@@ -291,32 +291,135 @@
 ne:%0A            
+try:%0A                self.Data = urlencode(params).encode('utf-8')%0A            except:%0A                
 self.Data = urll
@@ -420,22 +420,16 @@
 = urllib
-.parse
 .urlenco
@@ -597,39 +597,24 @@
     query = 
-urllib.request.
 Request(self
@@ -661,31 +661,16 @@
 query = 
-urllib.request.
 Request(
@@ -835,23 +835,8 @@
 urn 
-urllib.request.
 urlo
@@ -872,21 +872,8 @@
 ept 
-urllib.error.
 URLE

update document