| @@ 31-52 (lines=22) @@ | ||
| 28 | """ |
|
| 29 | Service Tumblr |
|
| 30 | """ |
|
| 31 | def __init__(self, token=None, **kwargs): |
|
| 32 | """ |
|
| 33 | ||
| 34 | :param token: |
|
| 35 | :param kwargs: |
|
| 36 | """ |
|
| 37 | super(ServiceTumblr, self).__init__(token, **kwargs) |
|
| 38 | self.AUTH_URL = 'https://www.tumblr.com/oauth/authorize' |
|
| 39 | self.ACC_TOKEN = 'https://www.tumblr.com/oauth/access_token' |
|
| 40 | self.REQ_TOKEN = 'https://www.tumblr.com/oauth/request_token' |
|
| 41 | self.consumer_key = settings.TH_TUMBLR_KEY['consumer_key'] |
|
| 42 | self.consumer_secret = settings.TH_TUMBLR_KEY['consumer_secret'] |
|
| 43 | self.token = token |
|
| 44 | self.service = 'ServiceTumblr' |
|
| 45 | self.oauth = 'oauth1' |
|
| 46 | if self.token is not None: |
|
| 47 | token_key, token_secret = self.token.split('#TH#') |
|
| 48 | ||
| 49 | self.tumblr = TumblrRestClient(self.consumer_key, |
|
| 50 | self.consumer_secret, |
|
| 51 | token_key, |
|
| 52 | token_secret) |
|
| 53 | ||
| 54 | def read_data(self, **kwargs): |
|
| 55 | """ |
|
| @@ 41-53 (lines=13) @@ | ||
| 38 | """ |
|
| 39 | Service Pushbullet |
|
| 40 | """ |
|
| 41 | def __init__(self, token=None, **kwargs): |
|
| 42 | super(ServicePushbullet, self).__init__(token, **kwargs) |
|
| 43 | self.AUTH_URL = 'https://pushbullet.com/authorize' |
|
| 44 | self.ACC_TOKEN = 'https://pushbullet.com/access_token' |
|
| 45 | self.REQ_TOKEN = 'https://api.pushbullet.com/oauth2/token' |
|
| 46 | self.consumer_key = settings.TH_PUSHBULLET_KEY['client_id'] |
|
| 47 | self.consumer_secret = settings.TH_PUSHBULLET_KEY['client_secret'] |
|
| 48 | self.scope = 'everything' |
|
| 49 | self.service = 'ServicePushbullet' |
|
| 50 | self.oauth = 'oauth2' |
|
| 51 | if token: |
|
| 52 | self.token = token |
|
| 53 | self.pushb = Pushb(token) |
|
| 54 | ||
| 55 | def read_data(self, **kwargs): |
|
| 56 | """ |
|
| @@ 39-51 (lines=13) @@ | ||
| 36 | """ |
|
| 37 | service Todoist |
|
| 38 | """ |
|
| 39 | def __init__(self, token=None, **kwargs): |
|
| 40 | super(ServiceTodoist, self).__init__(token, **kwargs) |
|
| 41 | self.AUTH_URL = 'https://todoist.com/oauth/authorize' |
|
| 42 | self.ACC_TOKEN = 'https://todoist.com/oauth/access_token' |
|
| 43 | self.REQ_TOKEN = 'https://todoist.com/oauth/access_token' |
|
| 44 | self.consumer_key = settings.TH_TODOIST_KEY['client_id'] |
|
| 45 | self.consumer_secret = settings.TH_TODOIST_KEY['client_secret'] |
|
| 46 | self.scope = 'task:add,data:read,data:read_write' |
|
| 47 | self.service = 'ServiceTodoist' |
|
| 48 | self.oauth = 'oauth2' |
|
| 49 | if token: |
|
| 50 | self.token = token |
|
| 51 | self.todoist = TodoistAPI(token) |
|
| 52 | ||
| 53 | def read_data(self, **kwargs): |
|
| 54 | """ |
|