diff --git a/.gitignore b/.gitignore index f9925bc..0c1b1ff 100644 --- a/.gitignore +++ b/.gitignore @@ -239,4 +239,7 @@ test_tmp/ #ignore deepsource.toml -.deepsource.toml \ No newline at end of file +.deepsource.toml + +# ignore pypi config + .pypirc diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c2051a..d127360 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.1.1] - 2022-05-27 + +### Added +- Resolved issue with REST based enrolment +- Generate enrolment report even on ctrl-c of run +- Tied external dependencies to known working versions + ## [4.1.0] - 2022-05-20 ### Added @@ -104,6 +111,8 @@ can continue as normal project running locally. Suitable for users who are not looking forward to contribute. +[4.1.1]: + https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/releases/tag/v4.1.1 [4.1.0]: https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/releases/tag/v4.1.0 [4.0.0]: diff --git a/pyproject.toml b/pyproject.toml index db6c555..4cd391a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,34 +1,30 @@ [tool.poetry] name = "automatic-udemy-course-enroller-get-paid-udemy-courses-for-free" -version = "4.1.0" +version = "4.1.1" description = "" authors = [""] [tool.poetry.dependencies] python = "^3.8" selenium = "^3.141.0" -beautifulsoup4 = "^4.9.3" -"ruamel.yaml" = "^0.16.12" -cloudscraper = "^1.2.56" -requests = "^2.25.1" -webdriver-manager = "^3.2.2" -aiohttp = {extras = ["speedups"], version = "^3.7.3"} +beautifulsoup4 = "^4.11.1" +"ruamel.yaml" = "^0.16.13" +cloudscraper = "^1.2.60" +requests = "^2.27.1" +webdriver-manager = "^3.7.0" +aiohttp = {extras = ["speedups"], version = "^3.8.1"} price-parser = "^0.3.4" [tool.poetry.dev-dependencies] -black = "^20.8b1" -isort = "^5.6.4" -pytest = "^6.1.2" -pytest-cov = "^2.10.1" -pytest-asyncio = "^0.14.0" -bumpver = "^2021.1113" - -[build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" +black = "^22.3.0" +isort = "^5.10.1" +pytest = "^7.1.2" +pytest-cov = "^3.0.0" +pytest-asyncio = "^0.18.3" +bumpver = "^2022.1116" [tool.bumpver] -current_version = "4.1.0" +current_version = "4.1.1" version_pattern = "MAJOR.MINOR.PATCH" commit_message = "Bump version {old_version} -> {new_version}" commit = true @@ -44,3 +40,6 @@ push = false 'version="{version}"', ] +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 38be014..b4c839d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -aiohttp[speedups] -beautifulsoup4 -ruamel.yaml -requests -cloudscraper -webdriver-manager -selenium -price-parser +aiohttp[speedups]==3.8.1 +beautifulsoup4==4.11.1 +ruamel.yaml==0.16.13 +requests==2.27.1 +cloudscraper==1.2.60 +webdriver-manager==3.7.0 +selenium==3.141.0 +price-parser==0.3.4 diff --git a/setup.py b/setup.py index 51dee73..ee0e4fe 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name="udemy-enroller", - version="4.1.0", + version="4.1.1", long_description=long_description, long_description_content_type="text/markdown", author="aapatre", @@ -27,14 +27,14 @@ ), python_requires=">=3.8, <4", install_requires=[ - "aiohttp[speedups]", - "beautifulsoup4", - "ruamel.yaml", - "requests", - "cloudscraper", - "webdriver-manager", - "selenium", - "price-parser", + "aiohttp[speedups]==3.8.1", + "beautifulsoup4==4.11.1", + "ruamel.yaml==0.16.13", + "requests==2.27.1", + "cloudscraper==1.2.60", + "webdriver-manager==3.7.0", + "selenium==3.141.0", + "price-parser==0.3.4", ], setup_requires=["pytest-runner"], extras_require={ diff --git a/udemy_enroller/driver_manager.py b/udemy_enroller/driver_manager.py index a93b0eb..d0d46d3 100644 --- a/udemy_enroller/driver_manager.py +++ b/udemy_enroller/driver_manager.py @@ -1,10 +1,10 @@ from selenium import webdriver from selenium.webdriver.chrome.options import Options as ChromeOptions from webdriver_manager.chrome import ChromeDriverManager +from webdriver_manager.core.utils import ChromeType from webdriver_manager.firefox import GeckoDriverManager from webdriver_manager.microsoft import EdgeChromiumDriverManager, IEDriverManager from webdriver_manager.opera import OperaDriverManager -from webdriver_manager.utils import ChromeType from udemy_enroller.logging import get_logger diff --git a/udemy_enroller/runner.py b/udemy_enroller/runner.py index 0f76c89..607cfcc 100644 --- a/udemy_enroller/runner.py +++ b/udemy_enroller/runner.py @@ -50,6 +50,7 @@ def _redeem_courses(settings: Settings, scrapers: ScraperManager) -> None: ) time.sleep(sleep_time) except KeyboardInterrupt: + udemy_actions.stats.table() logger.error("Exiting the script") return except Exception as e: diff --git a/udemy_enroller/udemy_rest.py b/udemy_enroller/udemy_rest.py index 20c6038..980b2b4 100644 --- a/udemy_enroller/udemy_rest.py +++ b/udemy_enroller/udemy_rest.py @@ -109,7 +109,7 @@ def __init__(self, settings: Settings, cookie_file_name: str = ".cookie"): self.settings = settings self.user_has_preferences = self.settings.categories or self.settings.languages self.session = requests.Session() - self.udemy_scraper = create_scraper() + self.udemy_scraper = create_scraper(ecdhCurve="secp384r1") self._cookie_file = os.path.join(get_app_dir(), cookie_file_name) self._enrolled_course_info = [] self._all_course_ids = [] @@ -129,11 +129,10 @@ def login(self, retry=False) -> None: if cookie_details is None: response = self.udemy_scraper.get(self.LOGIN_URL) soup = BeautifulSoup(response.content, "html.parser") - csrf_token = soup.find("input", {"name": "csrfmiddlewaretoken"}).get( - "value" - ) + csrf_element = soup.find("input", {"name": "csrfmiddlewaretoken"}) or {} + csrf_token = csrf_element.get("value") if csrf_token is None: - raise Exception(f"Unable to get csrf_token") + raise Exception("Unable to get csrf_token") # Prompt for email/password if we don't have them saved in settings if self.settings.email is None: