diff --git a/build/lib/src/__init__.py b/build/lib/src/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/build/lib/src/medium.py b/build/lib/src/medium.py deleted file mode 100644 index 9954965..0000000 --- a/build/lib/src/medium.py +++ /dev/null @@ -1,153 +0,0 @@ -import requests - -class MediumArticles: - def __init__(self): - self.URL = 'https://api.rss2json.com/v1/api.json?rss_url=https://medium.com/feed/' - self.error = { - "message": "Invalid username..." - } - - def get_base_url(self, username: str) -> str: - if username.strip().startswith('@'): - username = username[1:] - return f"{self.URL}@{username}" - - def get_data(self, username: str) -> dict: - try: - response = requests.get(self.get_base_url(username)) - response.raise_for_status() - data = response.json() - return data - except requests.exceptions.RequestException as e: - print(f'An error occurred while fetching data: {e}') - return {'error': 'An error occurred while fetching data'} - - def check_error(self, response: dict) -> bool: - return response.get('status') != 'ok' - - def get_profile_url(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['feed']['url'] - except Exception as e: - print(f'An error occurred while getting profile URL: {e}') - return self.error["message"] - - def get_profile_title(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['feed']['title'] - except Exception as e: - print(f'An error occurred while getting profile title: {e}') - return self.error["message"] - - def get_profile_author(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['feed']['author'] - except Exception as e: - print(f'An error occurred while getting profile author: {e}') - return self.error["message"] - - def get_profile_description(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['feed']['description'] - except Exception as e: - print(f'An error occurred while getting profile description: {e}') - return self.error["message"] - - def get_profile_image_url(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['feed']['image'] - except Exception as e: - print(f'An error occurred while getting profile image URL: {e}') - return self.error["message"] - - def get_latest_article_title(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['items'][0]['title'] - except Exception as e: - print(f'An error occurred while getting latest article title: {e}') - return self.error["message"] - - def get_latest_article_publication_date(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['items'][0]['pubDate'] - except Exception as e: - print(f'An error occurred while getting latest article publication date: {e}') - return self.error["message"] - - def get_latest_article_url(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['items'][0]['link'] - except Exception as e: - print(f'An error occurred while getting latest article URL: {e}') - return self.error["message"] - - def get_latest_article_description(self, username: str) -> str: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['items'][0]['description'] - except Exception as e: - print(f'An error occurred while getting latest article description: {e}') - return self.error["message"] - - def get_latest_article(self, username: str) -> dict: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - return data['items'][0] - except Exception as e: - print(f'An error occurred while getting latest article: {e}') - return self.error["message"] - - def get_latest_articles_title(self, username: str) -> list: - try: - data = self.get_data(username) - if self.check_error(data): - return self.error["message"] - res = [item['title'] for item in data['items']] - return res - except Exception as e: - print(f'An error occurred while getting latest article titles: {e}') - return self.error["message"] - -# Example usage -# if __name__ == "__main__": -# medium = MediumArticles() -# username = "@engrmuhammadusman108" -# print(medium.get_profile_url(username)) -# print(medium.get_profile_title(username)) -# print(medium.get_profile_author(username)) -# print(medium.get_profile_description(username)) -# print(medium.get_profile_image_url(username)) -# print(medium.get_latest_article_title(username)) -# print(medium.get_latest_article_publication_date(username)) -# print(medium.get_latest_article_url(username)) -# print(medium.get_latest_article_description(username)) -# print(medium.get_latest_article(username)) -# print(medium.get_latest_articles_title(username)) diff --git a/build/lib/test/__init__.py b/build/lib/test/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/build/lib/test/test_medium.py b/build/lib/test/test_medium.py deleted file mode 100644 index 8e6996f..0000000 --- a/build/lib/test/test_medium.py +++ /dev/null @@ -1,14 +0,0 @@ -import unittest -from src.medium import MediumArticles - -class TestOperations(unittest.TestCase): - def setUp(self): - self.medium_articles = MediumArticles() - self.username = "@engrmuhammadusman108" - - def test_get_profile_url(self): - result = self.medium_articles.get_profile_url(self.username) - self.assertEqual(result, 'https://medium.com/feed/@engrmuhammadusman108') - -if __name__ == '__main__': - unittest.main() \ No newline at end of file diff --git a/dist/medium_article_py-0.1.3-py3-none-any.whl b/dist/medium_article_py-0.1.3-py3-none-any.whl deleted file mode 100644 index 668eafc..0000000 Binary files a/dist/medium_article_py-0.1.3-py3-none-any.whl and /dev/null differ diff --git a/dist/medium_article_py-0.1.3.tar.gz b/dist/medium_article_py-0.1.3.tar.gz deleted file mode 100644 index 9559164..0000000 Binary files a/dist/medium_article_py-0.1.3.tar.gz and /dev/null differ diff --git a/medium_article_py.egg-info/PKG-INFO b/medium_article_py.egg-info/PKG-INFO deleted file mode 100644 index 33127a7..0000000 --- a/medium_article_py.egg-info/PKG-INFO +++ /dev/null @@ -1,56 +0,0 @@ -Metadata-Version: 2.1 -Name: medium-article-py -Version: 0.1.3 -Summary: A simple python library for Medium Articles APIs -Download-URL: https://github.com/muhammad-usman-108/medium-article-py.git -Author: Muhammad Usman -Author-email: umuhammad202@yahoo.com -Keywords: medium,medium-api,medium-article,api -Classifier: Programming Language :: Python :: 3 -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Requires-Python: >=3.6 -License-File: LICENSE -Requires-Dist: requests - -medium-article-py -==================================================== - -A Python library designed to retrieve articles and user information from Medium. This library offers an easy-to-use method for developers to incorporate Medium content into their applications. - - -Installation ------------- - -You can install this library using pip. - -.. code-block:: python - - pip install medium-article-py - - -Usage ------------- - -Here is a simple example to get you started: - -.. code-block:: python - - from medium-article-py import MediumArticles - username = '' - - print(MediumArticles.get_profile_url(username)) - # Output: https://medium.com/feed/@engrmuhammadusman108 - - - -Contributing ------------- - -- [Misbah Afzal](https://github.com/misbahafzal) -- [Muhammad Usman](https://github.com/muhammad-usman-108) - -LICENSE ------------- - -This project is licensed under the MIT License - see the [LICENSE](https://github.com/muhammad-usman-108/medium-article-api/blob/main/LICENSE) file for details. diff --git a/medium_article_py.egg-info/SOURCES.txt b/medium_article_py.egg-info/SOURCES.txt deleted file mode 100644 index f6299da..0000000 --- a/medium_article_py.egg-info/SOURCES.txt +++ /dev/null @@ -1,12 +0,0 @@ -LICENSE -README.rst -setup.py -medium_article_py.egg-info/PKG-INFO -medium_article_py.egg-info/SOURCES.txt -medium_article_py.egg-info/dependency_links.txt -medium_article_py.egg-info/requires.txt -medium_article_py.egg-info/top_level.txt -src/__init__.py -src/medium.py -test/__init__.py -test/test_medium.py \ No newline at end of file diff --git a/medium_article_py.egg-info/dependency_links.txt b/medium_article_py.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/medium_article_py.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/medium_article_py.egg-info/requires.txt b/medium_article_py.egg-info/requires.txt deleted file mode 100644 index f229360..0000000 --- a/medium_article_py.egg-info/requires.txt +++ /dev/null @@ -1 +0,0 @@ -requests diff --git a/medium_article_py.egg-info/top_level.txt b/medium_article_py.egg-info/top_level.txt deleted file mode 100644 index 281df39..0000000 --- a/medium_article_py.egg-info/top_level.txt +++ /dev/null @@ -1,2 +0,0 @@ -src -test diff --git a/setup.py b/setup.py index 1dac8a6..ae9fe75 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='medium-article-py', - version='v0.1.5', + version='v0.1.6', description='A simple python library for Medium Articles APIs', long_description=long_description, author='Muhammad Usman', diff --git a/src/__pycache__/__init__.cpython-312.pyc b/src/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 1ab9d26..0000000 Binary files a/src/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/src/__pycache__/medium.cpython-312.pyc b/src/__pycache__/medium.cpython-312.pyc deleted file mode 100644 index d8c14fc..0000000 Binary files a/src/__pycache__/medium.cpython-312.pyc and /dev/null differ