From d4bd92cdb81af188870d6f9371b84fa18f4a24d5 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Sun, 7 Jul 2013 14:57:00 +0200 Subject: [PATCH] Added __repr__() method to Connection() --- diaspy/connection.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/diaspy/connection.py b/diaspy/connection.py index 9ce4057..786158b 100644 --- a/diaspy/connection.py +++ b/diaspy/connection.py @@ -43,6 +43,14 @@ class Connection(): except Exception as e: raise LoginError('cannot create login data (caused by: {0}'.format(e)) + def __repr__(self): + """Returns token string. + It will be easier to change backend if programs will just use: + repr(connection) + instead of calling a specified method. + """ + return self.get_token() + def get(self, string, headers={}, params={}): """This method gets data from session. Performs additional checks if needed. -- 2.25.1