scoopy 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
scoopy-0.0.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
scoopy-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: scoopy
3
+ Version: 0.0.2
4
+ Summary: Python interface to live news
5
+ Home-page: https://github.com/thorwhalen/scoopy
6
+ Author: Thor Whalen
7
+ License: mit
8
+ Platform: any
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+
12
+
13
+ # scoopy
14
+ Python interface to live news
15
+
16
+
17
+ To install: ```pip install scoopy```
scoopy-0.0.2/README.md ADDED
@@ -0,0 +1,6 @@
1
+
2
+ # scoopy
3
+ Python interface to live news
4
+
5
+
6
+ To install: ```pip install scoopy```
@@ -0,0 +1,4 @@
1
+ """Access to news data"""
2
+
3
+
4
+ from scoopy.base import search_news
@@ -0,0 +1,42 @@
1
+ """Base functionality of scoopy"""
2
+
3
+ import os
4
+ from typing import Literal
5
+ from functools import lru_cache
6
+
7
+ NewSources = Literal['newsdata']
8
+ DFLT_NEWS_SOURCE = 'newsdata'
9
+
10
+
11
+ def search_news(query: str, source: NewSources = DFLT_NEWS_SOURCE, **kwargs):
12
+ if source == 'newsdata':
13
+ return _newsdata_search(query, **kwargs)
14
+ # https://newsdata.io/documentation
15
+ raise ValueError(f"Unknown news source: {source}")
16
+
17
+
18
+ def _get_config(key):
19
+ val = os.getenv(key)
20
+ if val is None:
21
+ raise ValueError(f"Missing environment variable: {key}")
22
+ return val
23
+
24
+
25
+ @lru_cache
26
+ def _newsdata_client():
27
+ from newsdataapi import NewsDataApiClient
28
+
29
+ return NewsDataApiClient(apikey=_get_config('NEWSDATA_API_KEY'))
30
+
31
+
32
+ def _newsdata_search(query, *, _egress=lambda x: x['results'], **kwargs):
33
+ # Initialize the client with your API key
34
+ api = _newsdata_client()
35
+
36
+ # Fetch news articles based on a query
37
+ response = api.latest_api(**kwargs)
38
+
39
+ if response['status'] != 'success':
40
+ raise ValueError(f"Newsdata API did not return a 'success' status.")
41
+
42
+ return _egress(response)
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: scoopy
3
+ Version: 0.0.2
4
+ Summary: Python interface to live news
5
+ Home-page: https://github.com/thorwhalen/scoopy
6
+ Author: Thor Whalen
7
+ License: mit
8
+ Platform: any
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+
12
+
13
+ # scoopy
14
+ Python interface to live news
15
+
16
+
17
+ To install: ```pip install scoopy```
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ setup.cfg
4
+ setup.py
5
+ scoopy/__init__.py
6
+ scoopy/base.py
7
+ scoopy.egg-info/PKG-INFO
8
+ scoopy.egg-info/SOURCES.txt
9
+ scoopy.egg-info/dependency_links.txt
10
+ scoopy.egg-info/not-zip-safe
11
+ scoopy.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ scoopy
scoopy-0.0.2/setup.cfg ADDED
@@ -0,0 +1,25 @@
1
+ [metadata]
2
+ name = scoopy
3
+ version = 0.0.2
4
+ url = https://github.com/thorwhalen/scoopy
5
+ platforms = any
6
+ description_file = README.md
7
+ root_url = https://github.com/thorwhalen/
8
+ license = mit
9
+ author = Thor Whalen
10
+ description = Python interface to live news
11
+ long_description = file:README.md
12
+ long_description_content_type = text/markdown
13
+ keywords =
14
+ display_name = scoopy
15
+
16
+ [options]
17
+ packages = find:
18
+ include_package_data = True
19
+ zip_safe = False
20
+ install_requires =
21
+
22
+ [egg_info]
23
+ tag_build =
24
+ tag_date = 0
25
+
scoopy-0.0.2/setup.py ADDED
@@ -0,0 +1,3 @@
1
+ from setuptools import setup
2
+
3
+ setup() # Note: Everything should be in the local setup.cfg