Skip to content

Commit

Permalink
update version to 1.0.5 - Excluded pandas dependency to streamline th…
Browse files Browse the repository at this point in the history
…e library and reduce external dependencies.
  • Loading branch information
asepscareer committed Jul 24, 2024
1 parent 44ad6a7 commit b1f3688
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 218 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
===========

1.0.5
-------
- Excluded pandas dependency to streamline the library and reduce external dependencies.

1.0.4
-------
- Remapping Query Data
Expand Down
56 changes: 44 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ ycnbc is **not** affiliated, endorsed, or vetted by CNBC, It's an open source to
### Requirements

- Python >=3.5+
- pandas>=0.24.0
- requests>=2.23.0
- lxml>=4.5.1

Expand All @@ -43,16 +42,49 @@ import ycnbc

data = ycnbc.News()

# get trending news
trending_ = data.trending() # return DataFrame

# get latest news
latest_ = data.latest() # return DataFrame

# get news by category
economy_ = data.economy() # return DataFrame

# etc.
# Get trending news
trending_ = data.trending()

# Get latest news
latest_ = data.latest()

# Get news by category
economy_ = data.economy()
jobs_ = data.jobs()
white_house_ = data.white_house()
hospitals_ = data.hospitals()
transportation_ = data.transportation()
media_ = data.media()
internet_ = data.internet()
congress_ = data.congress()
policy_ = data.policy()
finance_ = data.finance()
life_ = data.life()
defense_ = data.defense()
europe_politics_ = data.europe_politics()
china_politics_ = data.china_politics()
asia_politics_ = data.asia_politics()
world_politics_ = data.world_politics()
equity_opportunity_ = data.equity_opportunity()
politics_ = data.politics()
wealth_ = data.wealth()
world_economy_ = data.world_economy()
central_banks_ = data.central_banks()
real_estate_ = data.real_estate()
health_science_ = data.health_science()
small_business_ = data.small_business()
lifehealth_insurance_ = data.lifehealth_insurance()
business_ = data.business()
energy_ = data.energy()
industrials_ = data.industrials()
retail_ = data.retail()
cybersecurity_ = data.cybersecurity()
mobile_ = data.mobile()
technology_ = data.technology()
cnbc_disruptors_ = data.cnbc_disruptors()
tech_guide_ = data.tech_guide()
social_media_ = data.social_media()
climate_ = data.climate()
```

Note:
Expand All @@ -70,6 +102,6 @@ the [LICENSE.txt](./LICENSE.txt) file in the release for details.

### P.S.

Please drop me an note with any feedback you have.
Please drop me a note with any feedback you have.

**Asep Saputra**
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pandas>=0.24.0
requests>=2.23.0
lxml>=4.5.1
18 changes: 6 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# ycnbc - CNBC data downloader
# https://github.com/asepscareer/yfinance

"""ycnbc - cnbc data downloader"""
"""ycnbc - CNBC data downloader"""

from setuptools import setup, find_packages
# from codecs import open
import io
from os import path

Expand All @@ -18,7 +14,6 @@
version = line.replace("version = ", "").replace('"', '')
# --- /get version ---


here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
Expand All @@ -38,8 +33,6 @@
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Development Status :: 5 - Production/Stable',


'Operating System :: OS Independent',
'Intended Audience :: Developers',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: News/Diary',
Expand All @@ -48,7 +41,6 @@
'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',

'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand All @@ -59,9 +51,11 @@
platforms=['any'],
keywords='scrape news, cnbc library, cnbc python, cnbc api',
packages=find_packages(exclude=['contrib', 'docs', 'tests', 'examples']),
install_requires=['pandas>=0.24.0','requests>=2.23.0','lxml>=4.5.1'],
install_requires=['requests>=2.23.0', 'lxml>=4.5.1'],
entry_points={
'console_scripts': ['sample=sample:main',],
'console_scripts': [
# 'sample=sample:main',
],
},
)

Expand All @@ -70,4 +64,4 @@
NOTE: ycnbc is not affiliated, endorsed, or vetted by CNBC.
You should refer to CNBC!'s terms of use for details on your rights to use the actual data downloaded.
"""
)
)
59 changes: 51 additions & 8 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,57 @@
import unittest

data = ycnbc.News()


class TestData(unittest.TestCase):
def test_trending(self):
assert(data.trending().empty is False)
assert(data.latest().empty is False)
assert(data.economy().empty is False)
assert(data.health_science().empty is False)
assert(data.finance().empty is False)

def test_cnbc_news(self):
methods = [
'latest',
'trending',
'economy',
'jobs',
'white_house',
'hospitals',
'transportation',
'media',
'internet',
'congress',
'policy',
'finance',
'life',
'defense',
'europe_politics',
'china_politics',
'asia_politics',
'world_politics',
'equity_opportunity',
'politics',
'wealth',
'world_economy',
'central_banks',
'real_estate',
'health_science',
'small_business',
'lifehealth_insurance',
'business',
'energy',
'industrials',
'retail',
'cybersecurity',
'mobile',
'technology',
'cnbc_disruptors',
'tech_guide',
'social_media',
'climate'
]

for method_name in methods:
with self.subTest(method=method_name):
method = getattr(data, method_name)
response = method()
self.assertNotIn("error", response, f"{method_name} returned an error")


if __name__ == '__main__':
unittest.main()
unittest.main()
Loading

0 comments on commit b1f3688

Please sign in to comment.