I had an issue when trying to run the code. After I entered the URL into the console, an error message appeared:
"Request connection failed. Exiting..."
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\grequests.py:22: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util.ssl_ (C:\\Users\\User\\AppData\\Roaming\\Python\\Python39\\site-packages\\urllib3\\util\\ssl_.py)', 'urllib3.util (C:\\Users\\User\\AppData\\Roaming\\Python\\Python39\\site-packages\\urllib3\\util\\__init__.py)'].
curious_george.patch_all(thread=False, select=False)
[>] Enter the coursehero url: https://www.coursehero.com/file/39711060/BIO-101-Class-Notes-2docx/
[>] Request connection failed. Exiting...
I then removed the try-except statement from the code @ Line 88 and ran it again. This was the error I received:
"RecursionError: maximum recursion depth exceeded"
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\grequests.py:22: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util (C:\\Users\\User\\AppData\\Roaming\\Python\\Python39\\site-packages\\urllib3\\util\\__init__.py)', 'urllib3.util.ssl_ (C:\\Users\\User\\AppData\\Roaming\\Python\\Python39\\site-packages\\urllib3\\util\\ssl_.py)'].
curious_george.patch_all(thread=False, select=False)
[>] Enter the coursehero url: https://www.coursehero.com/file/39711060/BIO-101-Class-Notes-2docx/
Traceback (most recent call last):
File "c:\Users\User\Downloads\CourseHeroUnblur.py", line 89, in <module>
resp = session.get(url, headers=make_headers())
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\connection.py", line 397, in connect
self.ssl_context = create_urllib3_context(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\urllib3\util\ssl_.py", line 312, in create_urllib3_context
context.options |= options
File "C:\Program Files\Python39\lib\ssl.py", line 602, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "C:\Program Files\Python39\lib\ssl.py", line 602, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "C:\Program Files\Python39\lib\ssl.py", line 602, in options
super(SSLContext, SSLContext).options.__set__(self, value)
[Previous line repeated 492 more times]
RecursionError: maximum recursion depth exceeded
import gevent.monkey
gevent.monkey.patch_all()
After inserting those two lines at the top of the code, everything seems to work fine.
I don't know why the code isn't working before the fix. I thought I would just let you know here and perhaps help others
who might have the same issue. I have to say, I love this program. It's working great and I appreciate your time and effort.