Skip to content

Commit 0a62171

Browse files
Merge pull request #466 from scholarly-python-package/develop
Unmix return and yield from from a single function
2 parents 1851dc8 + 55d2c80 commit 0a62171

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ beautifulsoup4
33
bibtexparser
44
deprecated
55
fake_useragent
6-
free-proxy<1.1.0
6+
free-proxy
77
python-dotenv
88
requests[socks]
99
selenium

scholarly/_proxy_generator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,10 @@ def _fp_coroutine(self, timeout=1, wait_time=120):
483483
freeproxy = FreeProxy(rand=False, timeout=timeout)
484484
if not hasattr(self, '_dirty_freeproxies'):
485485
self._dirty_freeproxies = set()
486-
all_proxies = freeproxy.get_proxy_list()
486+
try:
487+
all_proxies = freeproxy.get_proxy_list(repeat=False) # free-proxy >= 1.1.0
488+
except TypeError:
489+
all_proxies = freeproxy.get_proxy_list() # free-proxy < 1.1.0
487490
all_proxies.reverse() # Try the older proxies first
488491

489492
t1 = time.time()

scholarly/_scholarly.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ def citedby(self, object: Publication)->_SearchScholarIterator:
305305
# Go one year at a time in decreasing order
306306
years = zip(range(year_end, year_low-1, -1), range(year_end, year_low-1, -1))
307307

308+
return self._citedby_long(object,years)
309+
310+
def _citedby_long(self, object: Publication, years):
308311
# Extract cites_id. Note: There could be multiple ones, separated by commas.
309312
m = re.search("cites=[\d+,]*", object["citedby_url"])
310313
pub_id = m.group()[6:]

0 commit comments

Comments
 (0)