Skip to content

Commit 74e6854

Browse files
authored
Merge pull request #11 from LouisTrezzini/master
Breaking change: moving the api_client in its own subpackage to clear out the feedly namespace
2 parents ef4f8ea + 1f238a8 commit 74e6854

File tree

7 files changed

+23
-38
lines changed

7 files changed

+23
-38
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ initalize the client as follows:
1616

1717
```
1818
from pathlib import Path
19-
from feedly.session import FeedlySession
19+
from feedly.api_client.session import FeedlySession
2020
2121
token = (Path.home() / 'access.token').read_text().strip()
2222
sess = FeedlySession(token)
@@ -117,4 +117,4 @@ To debug things, set the log level to `DEBUG`. This will print log messages on e
117117
The above examples assume the auth (access) token is valid. However these tokens do expire. Instead
118118
of passing the auth token itself, you can create a `feedly.session.Auth` implementation to refresh
119119
the auth token. A file based implementation is already provided (`FileAuthStore`). Once this is done
120-
the client will automatically try to refresh the auth token if a `401` response is encountered.
120+
the client will automatically try to refresh the auth token if a `401` response is encountered.

feedly/data.py renamed to feedly/api_client/data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
handy getter methods, but otherwise you can just use a .json property to access the
44
raw json passed back by the client.
55
"""
6-
from typing import Any, Dict, Optional, Callable, Union, List
6+
from typing import Any, Callable, Dict, List, Optional, Union
77
from urllib.parse import quote_plus
88

9-
from feedly.protocol import APIClient
10-
from feedly.stream import STREAM_SOURCE_USER, StreamOptions, StreamBase, UserStreamId, EnterpriseStreamId, StreamIdBase, STREAM_SOURCE_ENTERPRISE
11-
import logging
9+
from feedly.api_client.protocol import APIClient
10+
from feedly.api_client.stream import EnterpriseStreamId, STREAM_SOURCE_ENTERPRISE, STREAM_SOURCE_USER, StreamBase, StreamIdBase, StreamOptions, UserStreamId
11+
1212

1313
class FeedlyData:
1414
def __init__(self, json:Dict[str,Any], client:APIClient=None):
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import datetime
2+
import json
13
import time
2-
from typing import Optional, Dict, Union, Any, List
3-
from requests.exceptions import HTTPError
4+
from typing import Any, Dict, List, Optional, Union
5+
46
from requests import Response
5-
import json
6-
import datetime
7+
from requests.exceptions import HTTPError
78

89

910
class WrappedHTTPError(HTTPError):
Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
from pprint import pprint
1+
import datetime
2+
import logging
23
import time
34
from pathlib import Path
4-
from typing import Dict, Any, Union, List, Optional
5-
6-
import logging
7-
8-
import datetime
5+
from pprint import pprint
6+
from typing import Any, Dict, List, Union
97
from urllib.parse import quote_plus
108

9+
from requests import Session
1110
from requests.adapters import HTTPAdapter
1211
from requests.exceptions import HTTPError
1312

14-
from requests import Session
15-
16-
from feedly.data import FeedlyUser
17-
from feedly.protocol import RateLimitedAPIError, BadRequestAPIError, UnauthorizedAPIError, ServerAPIError, APIClient, WrappedHTTPError
18-
from feedly.stream import StreamIdBase
13+
from feedly.api_client.data import FeedlyUser
14+
from feedly.api_client.protocol import APIClient, BadRequestAPIError, RateLimitedAPIError, ServerAPIError, UnauthorizedAPIError
1915

2016

2117
class Auth:
@@ -218,14 +214,3 @@ def do_api_request(self, relative_url:str, method:str=None, data:Dict=None,
218214
raise ServerAPIError(e)
219215

220216
raise e
221-
222-
if __name__ == '__main__':
223-
logging.basicConfig(level='DEBUG')
224-
# token = (Path.home() / 'access.token').read_text().strip()
225-
auth = FileAuthStore(Path.home())
226-
# print(sess.user['fullName'])
227-
228-
sess = FeedlySession(auth)
229-
230-
for k, v in sess.user.get_categories().items():
231-
pprint(f"{k} -- {v['label']}")
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
import logging
12
from collections import deque
23
from typing import List
34
from urllib.parse import quote_plus
45

5-
import logging
6-
7-
from feedly.protocol import APIClient
6+
from feedly.api_client.protocol import APIClient
87

98
STREAM_SOURCE_USER:str = 'user'
109
STREAM_SOURCE_ENTERPRISE:str = 'enterprise'

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
EMAIL = 'kireet@feedly.com'
1919
AUTHOR = 'Kireet'
2020
REQUIRES_PYTHON = '>=3.6.0'
21-
VERSION = 0.19
21+
VERSION = '0.20'
2222

2323
# What packages are required for this module to be executed?
2424
with open('requirements.txt') as f:
@@ -87,7 +87,7 @@ def run(self):
8787
self.status('Pushing git tags…')
8888
os.system('git tag v{0}'.format(about['__version__']))
8989
os.system('git push --tags')
90-
90+
9191
sys.exit()
9292

9393

@@ -102,7 +102,7 @@ def run(self):
102102
author_email=EMAIL,
103103
python_requires=REQUIRES_PYTHON,
104104
url=URL,
105-
packages=find_packages(exclude=('tests',)),
105+
packages=['feedly.api_client'],
106106
# If your package is a single module, use this instead of 'packages':
107107
# py_modules=['mypackage'],
108108

0 commit comments

Comments
 (0)