Skip to content

Commit 1a39b92

Browse files
committed
Fix packaging and make Python3-compliant (removing unused websockets)
1 parent da157ef commit 1a39b92

File tree

5 files changed

+10
-37
lines changed

5 files changed

+10
-37
lines changed

MANIFEST.in

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include requirements.txt
2+
include LICENSE
3+
include README.md
4+
5+
global-exclude *.pyc
6+
global-exclude __pycache__

notion/monitor.py

-33
Original file line numberDiff line numberDiff line change
@@ -192,36 +192,3 @@ def poll_async(self):
192192
def poll_forever(self):
193193
while True:
194194
self.poll()
195-
196-
def poll_forever_websocket(self):
197-
"""
198-
An alternative implementation of the watch behavior using websockets. Doesn't seem to be particularly faster.
199-
Note: requires installation of the "asyncio" and "websockets" packages.
200-
"""
201-
202-
import asyncio
203-
import websockets
204-
205-
async def hello():
206-
207-
while True:
208-
try:
209-
210-
self.initialize()
211-
212-
headers = [("Cookie", "AWSALB={};".format(self.client.session.cookies.get("AWSALB")))]
213-
214-
url = "wss://msgstore.www.notion.so/primus/?sessionId={}&EIO=3&transport=websocket&sid={}".format(self.session_id, self.sid)
215-
216-
async with websockets.connect(url, extra_headers=headers) as websocket:
217-
await websocket.send("2probe")
218-
await websocket.recv()
219-
await websocket.send("5")
220-
while True:
221-
event = json.loads(re.match("\d+(.*)", await websocket.recv()).groups()[0])
222-
self._refresh_updated_records([event])
223-
224-
except websockets.ConnectionClosed:
225-
pass
226-
227-
asyncio.get_event_loop().run_until_complete(hello())

notion/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
API_BASE_URL = BASE_URL + "api/v3/"
66
SIGNED_URL_PREFIX = "https://www.notion.so/signed/"
77
S3_URL_PREFIX = "https://s3-us-west-2.amazonaws.com/secure.notion-static.com/"
8-
DATA_DIR = str(Path.home().joinpath(".notion-py"))
8+
DATA_DIR = str(Path(os.path.expanduser("~")).joinpath(".notion-py"))
99
CACHE_DIR = str(Path(DATA_DIR).joinpath("cache"))
1010
LOG_FILE = str(Path(DATA_DIR).joinpath("notion.log"))
1111

requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ commonmark
33
bs4
44
tzlocal
55
python-slugify
6-
# asyncio
7-
# websockets
86
dictdiffer

setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313

1414
setuptools.setup(
1515
name="notion",
16-
version="0.0.9",
16+
version="0.0.15",
1717
author="Jamie Alexandre",
1818
author_email="jamalex+python@gmail.com",
1919
description="Unofficial Python API client for Notion.so",
2020
long_description=long_description,
2121
long_description_content_type="text/markdown",
2222
url="https://github.com/jamalex/notion-py",
2323
install_requires=install_requires,
24+
include_package_data=True,
2425
packages=setuptools.find_packages(),
26+
python_requires='>=3.4',
2527
classifiers=[
2628
"Programming Language :: Python :: 3",
2729
"License :: OSI Approved :: MIT License",

0 commit comments

Comments
 (0)