@@ -701,7 +701,7 @@ def _fill_in_response_column_ids(cls, request_columns,
701
701
for req_col in request_columns :
702
702
for resp_col in response_columns :
703
703
if resp_col ['name' ] == req_col .name :
704
- req_col .id = '{}/{}' .format (grid_id , resp_col ['uid' ])
704
+ req_col .id = '{0 }/{1 }' .format (grid_id , resp_col ['uid' ])
705
705
response_columns .remove (resp_col )
706
706
707
707
@classmethod
@@ -751,7 +751,7 @@ def upload(cls, grid, filename,
751
751
grid .id = grid_id
752
752
753
753
plotly_domain = get_config ()['plotly_domain' ]
754
- grid_url = '{}/~{}' .format (plotly_domain , grid_id .replace (':' , '/' ))
754
+ grid_url = '{0 }/~{1 }' .format (plotly_domain , grid_id .replace (':' , '/' ))
755
755
756
756
if meta is not None :
757
757
meta_ops .upload (meta , grid = grid )
@@ -800,8 +800,8 @@ def append_rows(cls, rows, grid=None, grid_url=None):
800
800
raise exceptions .InputError (
801
801
"The number of entries in "
802
802
"each row needs to equal the number of columns in "
803
- "the grid. Row {} has {} {} but your "
804
- "grid has {} {}. "
803
+ "the grid. Row {0 } has {1 } {2 } but your "
804
+ "grid has {3 } {4 }. "
805
805
.format (row_i , len (row ),
806
806
'entry' if len (row ) == 1 else 'entries' ,
807
807
n_columns ,
@@ -896,7 +896,7 @@ def parse_grid_id_args(cls, grid, grid_url):
896
896
if supplied_arg_name == 'grid_url' :
897
897
path = urlparse (grid_url ).path
898
898
file_owner , file_id = path .replace ("/~" , "" ).split ('/' )[0 :2 ]
899
- return '{}:{}' .format (file_owner , file_id )
899
+ return '{0 }:{1 }' .format (file_owner , file_id )
900
900
else :
901
901
return grid .id
902
902
@@ -913,7 +913,7 @@ def response_handler(cls, response):
913
913
'json' in response .headers ['content-type' ] and
914
914
len (response .content ) > 0 ):
915
915
916
- response_dict = json .loads (response .content )
916
+ response_dict = json .loads (response .content . decode ( 'utf8' ) )
917
917
918
918
if 'warnings' in response_dict and len (response_dict ['warnings' ]):
919
919
warnings .warn ('\n ' .join (response_dict ['warnings' ]))
@@ -922,16 +922,19 @@ def response_handler(cls, response):
922
922
923
923
@classmethod
924
924
def api_url (cls , resource ):
925
- return ('{}/v2/{}' .format (get_config ()['plotly_api_domain' ],
925
+ return ('{0 }/v2/{1 }' .format (get_config ()['plotly_api_domain' ],
926
926
resource ))
927
927
928
928
@classmethod
929
929
def headers (cls ):
930
930
un , api_key = _get_session_username_and_key ()
931
- encoded_un_key_pair = base64 .b64encode ('{}:{}' .format (un , api_key ))
931
+ encoded_un_key_pair = base64 .b64encode (
932
+ six .b ('{0}:{1}' .format (un , api_key ))
933
+ ).decode ('utf8' )
934
+
932
935
return {
933
936
'authorization' : 'Basic ' + encoded_un_key_pair ,
934
- 'plotly-client-platform' : 'python {}' .format (version .__version__ )
937
+ 'plotly-client-platform' : 'python {0 }' .format (version .__version__ )
935
938
}
936
939
937
940
0 commit comments