31
31
32
32
import base64
33
33
import copy
34
+ import io
35
+ import http .cookiejar # used for attachment upload
34
36
import datetime
35
37
import json
36
38
import logging
45
47
import uuid # used for attachment upload
46
48
47
49
# Python 2/3 compatibility
48
- from .lib import six
49
- from .lib import sgsix
50
50
from .lib import sgutils
51
51
from io import BytesIO # used for attachment upload
52
52
@@ -672,9 +672,15 @@ def __init__(
672
672
# the lowercase version of the credentials.
673
673
auth , self .config .server = self ._split_url (base_url )
674
674
if auth :
675
+ < << << << HEAD
675
676
auth = base64 .encodebytes (
676
677
sgutils .ensure_binary (urllib .parse .unquote (auth ))
677
678
).decode ("utf-8" )
679
+ == == == =
680
+ auth = base64encode (urllib .parse .unquote (auth ).encode ("utf-8" )).decode (
681
+ "utf-8"
682
+ )
683
+ >> >> >> > f64d7ea (black format )
678
684
self .config .authorization = "Basic " + auth .strip ()
679
685
680
686
@@ -2221,8 +2227,7 @@ def schema_field_update(
2221
2227
"type" : entity_type ,
2222
2228
"field_name" : field_name ,
2223
2229
"properties" : [
2224
- {"property_name" : k , "value" : v }
2225
- for k , v in (properties or {}).items ()
2230
+ {"property_name" : k , "value" : v } for k , v in (properties or {}).items ()
2226
2231
],
2227
2232
}
2228
2233
params = self ._add_project_param (params , project_entity )
@@ -4556,7 +4561,9 @@ def encode(self, params, files, boundary=None, buffer=None):
4556
4561
key = key .decode ("utf-8" ) if isinstance (key , bytes ) else str (key )
4557
4562
4558
4563
buffer .write (("--%s\r \n " % boundary ).encode ("utf-8" ))
4559
- buffer .write (('Content-Disposition: form-data; name="%s"' % key ).encode ("utf-8" ))
4564
+ buffer .write (
4565
+ ('Content-Disposition: form-data; name="%s"' % key ).encode ("utf-8" )
4566
+ )
4560
4567
buffer .write (("\r \n \r \n %s\r \n " % value ).encode ("utf-8" ))
4561
4568
for key , fd in files :
4562
4569
# On Windows, it's possible that we were forced to open a file
@@ -4565,7 +4572,11 @@ def encode(self, params, files, boundary=None, buffer=None):
4565
4572
# If we don't, the mix of unicode and strings going into the
4566
4573
# buffer can cause UnicodeEncodeErrors to be raised.
4567
4574
filename = fd .name
4568
- filename = filename .decode ("utf-8" ) if isinstance (filename , bytes ) else str (filename )
4575
+ filename = (
4576
+ filename .decode ("utf-8" )
4577
+ if isinstance (filename , bytes )
4578
+ else str (filename )
4579
+ )
4569
4580
filename = filename .split ("/" )[- 1 ]
4570
4581
key = key .decode ("utf-8" ) if isinstance (key , bytes ) else str (key )
4571
4582
content_type = mimetypes .guess_type (filename )[0 ]
0 commit comments