@@ -701,7 +701,7 @@ def _fill_in_response_column_ids(cls, request_columns,
701701 for req_col in request_columns :
702702 for resp_col in response_columns :
703703 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' ])
705705 response_columns .remove (resp_col )
706706
707707 @classmethod
@@ -751,7 +751,7 @@ def upload(cls, grid, filename,
751751 grid .id = grid_id
752752
753753 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 (':' , '/' ))
755755
756756 if meta is not None :
757757 meta_ops .upload (meta , grid = grid )
@@ -800,8 +800,8 @@ def append_rows(cls, rows, grid=None, grid_url=None):
800800 raise exceptions .InputError (
801801 "The number of entries in "
802802 "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 }. "
805805 .format (row_i , len (row ),
806806 'entry' if len (row ) == 1 else 'entries' ,
807807 n_columns ,
@@ -896,7 +896,7 @@ def parse_grid_id_args(cls, grid, grid_url):
896896 if supplied_arg_name == 'grid_url' :
897897 path = urlparse (grid_url ).path
898898 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 )
900900 else :
901901 return grid .id
902902
@@ -913,7 +913,7 @@ def response_handler(cls, response):
913913 'json' in response .headers ['content-type' ] and
914914 len (response .content ) > 0 ):
915915
916- response_dict = json .loads (response .content )
916+ response_dict = json .loads (response .content . decode ( 'utf8' ) )
917917
918918 if 'warnings' in response_dict and len (response_dict ['warnings' ]):
919919 warnings .warn ('\n ' .join (response_dict ['warnings' ]))
@@ -922,16 +922,19 @@ def response_handler(cls, response):
922922
923923 @classmethod
924924 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' ],
926926 resource ))
927927
928928 @classmethod
929929 def headers (cls ):
930930 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+
932935 return {
933936 'authorization' : 'Basic ' + encoded_un_key_pair ,
934- 'plotly-client-platform' : 'python {}' .format (version .__version__ )
937+ 'plotly-client-platform' : 'python {0 }' .format (version .__version__ )
935938 }
936939
937940
0 commit comments