diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..6c7aefc --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include requirements.txt +include LICENSE +include README.md + +global-exclude *.pyc +global-exclude __pycache__ \ No newline at end of file diff --git a/notion/monitor.py b/notion/monitor.py index deb9958..e6e5058 100644 --- a/notion/monitor.py +++ b/notion/monitor.py @@ -192,36 +192,3 @@ def poll_async(self): def poll_forever(self): while True: self.poll() - - def poll_forever_websocket(self): - """ - An alternative implementation of the watch behavior using websockets. Doesn't seem to be particularly faster. - Note: requires installation of the "asyncio" and "websockets" packages. - """ - - import asyncio - import websockets - - async def hello(): - - while True: - try: - - self.initialize() - - headers = [("Cookie", "AWSALB={};".format(self.client.session.cookies.get("AWSALB")))] - - url = "wss://msgstore.www.notion.so/primus/?sessionId={}&EIO=3&transport=websocket&sid={}".format(self.session_id, self.sid) - - async with websockets.connect(url, extra_headers=headers) as websocket: - await websocket.send("2probe") - await websocket.recv() - await websocket.send("5") - while True: - event = json.loads(re.match("\d+(.*)", await websocket.recv()).groups()[0]) - self._refresh_updated_records([event]) - - except websockets.ConnectionClosed: - pass - - asyncio.get_event_loop().run_until_complete(hello()) \ No newline at end of file diff --git a/notion/settings.py b/notion/settings.py index 6f5d1a5..6d1000d 100644 --- a/notion/settings.py +++ b/notion/settings.py @@ -5,7 +5,7 @@ API_BASE_URL = BASE_URL + "api/v3/" SIGNED_URL_PREFIX = "https://www.notion.so/signed/" S3_URL_PREFIX = "https://s3-us-west-2.amazonaws.com/secure.notion-static.com/" -DATA_DIR = str(Path.home().joinpath(".notion-py")) +DATA_DIR = str(Path(os.path.expanduser("~")).joinpath(".notion-py")) CACHE_DIR = str(Path(DATA_DIR).joinpath("cache")) LOG_FILE = str(Path(DATA_DIR).joinpath("notion.log")) diff --git a/requirements.txt b/requirements.txt index 9a47019..c4213fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,4 @@ commonmark bs4 tzlocal python-slugify -# asyncio -# websockets dictdiffer \ No newline at end of file diff --git a/setup.py b/setup.py index b6da3c5..53791dd 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setuptools.setup( name="notion", - version="0.0.9", + version="0.0.15", author="Jamie Alexandre", author_email="jamalex+python@gmail.com", description="Unofficial Python API client for Notion.so", @@ -21,7 +21,9 @@ long_description_content_type="text/markdown", url="https://github.com/jamalex/notion-py", install_requires=install_requires, + include_package_data=True, packages=setuptools.find_packages(), + python_requires='>=3.4', classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License",