@@ -254,27 +254,6 @@ def session_context(self):
254
254
255
255
return self ._session_context
256
256
257
- def to_json (self ):
258
- """
259
- Serializes an ApiContext to JSON string
260
-
261
- :rtype: str
262
- """
263
-
264
- return converter .class_to_json (self )
265
-
266
- @classmethod
267
- def from_json (cls , data ):
268
- """
269
- Creates an ApiContext instance from JSON string.
270
-
271
- :type data: str
272
-
273
- :rtype: ApiContext
274
- """
275
-
276
- return converter .json_to_class (ApiContext , data )
277
-
278
257
def save (self , path = None ):
279
258
"""
280
259
:type path: str
@@ -288,6 +267,15 @@ def save(self, path=None):
288
267
with open (path , self ._FILE_MODE_WRITE ) as file_ :
289
268
file_ .write (self .to_json ())
290
269
270
+ def to_json (self ):
271
+ """
272
+ Serializes an ApiContext to JSON string.
273
+
274
+ :rtype: str
275
+ """
276
+
277
+ return converter .class_to_json (self )
278
+
291
279
@classmethod
292
280
def restore (cls , path = None ):
293
281
"""
@@ -301,6 +289,18 @@ def restore(cls, path=None):
301
289
302
290
with open (path , cls ._FILE_MODE_READ ) as file_ :
303
291
return cls .from_json (file_ .read ())
292
+
293
+ @classmethod
294
+ def from_json (cls , json_str ):
295
+ """
296
+ Creates an ApiContext instance from JSON string.
297
+
298
+ :type json_str: str
299
+
300
+ :rtype: ApiContext
301
+ """
302
+
303
+ return converter .json_to_class (ApiContext , json_str )
304
304
305
305
def __eq__ (self , other ):
306
306
return (self .token == other .token and
0 commit comments