@@ -26,6 +26,8 @@ def process_token_request(r, decoder, *args):
26
26
27
27
28
28
class Service (object ):
29
+ __attrs__ = ['name' , 'base_url' , 'authorize_url' ]
30
+
29
31
def __init__ (self , name , base_url , authorize_url ):
30
32
#: The service name, e.g. 'twitter'.
31
33
self .name = name
@@ -36,6 +38,14 @@ def __init__(self, name, base_url, authorize_url):
36
38
#: The authorization URL.
37
39
self .authorize_url = authorize_url
38
40
41
+ def __getstate__ (self ):
42
+ return dict ((attr , getattr (self , attr , None )) for
43
+ attr in self .__attrs__ )
44
+
45
+ def __setstate__ (self , state ):
46
+ for attr , value in state .items ():
47
+ setattr (self , attr , value )
48
+
39
49
40
50
class OAuth1Service (Service ):
41
51
'''
@@ -116,6 +126,12 @@ class OAuth1Service(Service):
116
126
to :class:`rauth.HmacSha1Signature <HmacSha1Signature>`
117
127
:type signature_obj: :class:`SignatureMethod`
118
128
'''
129
+ __attrs__ = Service .__attrs__ + ['consumer_key' ,
130
+ 'consumer_secret' ,
131
+ 'request_token_url' ,
132
+ 'access_token_url' ,
133
+ 'session_obj' ]
134
+
119
135
def __init__ (self ,
120
136
consumer_key ,
121
137
consumer_secret ,
@@ -396,6 +412,11 @@ class OAuth2Service(Service):
396
412
:class:`OAuth2Session`
397
413
:type session_obj: :class:`rauth.Session`
398
414
'''
415
+ __attrs__ = Service .__attrs__ + ['client_id' ,
416
+ 'client_secret' ,
417
+ 'access_token_url' ,
418
+ 'session_obj' ]
419
+
399
420
def __init__ (self ,
400
421
client_id ,
401
422
client_secret ,
@@ -557,6 +578,11 @@ class OflyService(Service):
557
578
`rauth.OflySession`
558
579
:type session_obj: :class:`rauth.Session`
559
580
'''
581
+ __attrs__ = Service .__attrs__ + ['app_id' ,
582
+ 'app_secret' ,
583
+ 'user_id' ,
584
+ 'session_obj' ]
585
+
560
586
def __init__ (self ,
561
587
app_id ,
562
588
app_secret ,
0 commit comments