@@ -123,7 +123,7 @@ Search by keyword and return a generator of Author objects.
123123 ' source' : ' SEARCH_AUTHOR_SNIPPETS' ,
124124 ' url_picture' : ' https://scholar.google.com/citations?view_op=medium_photo&user=lHrs3Y4AAAAJ' }
125125
126- ``search_pubs ``
126+ ``search_pubs ``
127127^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128128Search for articles/publications and return generator of Publication objects.
129129#############################################################################
@@ -363,7 +363,8 @@ Using proxies
363363-------------
364364
365365In general, Google Scholar does not like bots, and can often block
366- scholarly. We are actively working towards making scholarly more robust
366+ scholarly, especially those pages that contain ``scholar? `` in the URL.
367+ We are actively working towards making scholarly more robust
367368towards that front.
368369
369370The most common solution for avoiding network issues is to use proxies
@@ -390,12 +391,18 @@ come from the ProxyGenerator class:
390391- Tor\_ Internal()
391392- Tor\_ External()
392393- Luminati()
394+ - ScraperAPI()
393395- FreeProxies()
394- - SingleProxy() Example:
396+ - SingleProxy()
397+
398+ All of these methods return ``True `` if the proxy was setup successfully which
399+ you can check before beginning to use it with the ``use_proxy `` method.
400+
401+ Example:
395402
396403.. code :: python
397404
398- pg.SingleProxy(http = < your http proxy> , https = < your https proxy> )
405+ success = pg.SingleProxy(http = < your http proxy> , https = < your https proxy> )
399406
400407 Finally set scholarly to use this proxy for your actions
401408
@@ -438,7 +445,7 @@ default password, but you may want to change it for your installation.)
438445 from scholarly import scholarly, ProxyGenerator
439446
440447 pg = ProxyGenerator()
441- pg.Tor_External(tor_sock_port = 9050 , tor_control_port = 9051 , tor_password = " scholarly_password" )
448+ success = pg.Tor_External(tor_sock_port = 9050 , tor_control_port = 9051 , tor_password = " scholarly_password" )
442449 scholarly.use_proxy(pg)
443450
444451 author = next (scholarly.search_author(' Steven A Cholewiak' ))
@@ -458,26 +465,7 @@ executable in your system.
458465 from scholarly import scholarly, ProxyGenerator
459466
460467 pg = ProxyGenerator()
461- pg.Tor_Internal(tor_cmd = " tor" )
462- scholarly.use_proxy(pg)
463-
464- author = next (scholarly.search_author(' Steven A Cholewiak' ))
465- scholarly.pprint(author)
466-
467- ``FreeProxies ``
468- ^^^^^^^^^^^^^^^^^^^^
469- pg.FreeProxies()
470- ################
471-
472- This uses the ``free-proxy `` pip library to add a proxy to your
473- configuration.
474-
475- .. code :: python
476-
477- from scholarly import scholarly, ProxyGenerator
478-
479- pg = ProxyGenerator()
480- pg.FreeProxies()
468+ success = pg.Tor_Internal(tor_cmd = " tor" )
481469 scholarly.use_proxy(pg)
482470
483471 author = next (scholarly.search_author(' Steven A Cholewiak' ))
@@ -502,7 +490,7 @@ You can use your own configuration
502490
503491.. code :: python
504492
505- pg.Luminati(usr = " your_username" ,passwd = " your_password" , port = " your_port" )
493+ success = pg.Luminati(usr = " your_username" ,passwd = " your_password" , port = " your_port" )
506494
507495 Or alternatively you can use the environment variables set in your .env
508496file
@@ -519,6 +507,61 @@ file
519507 author = next (scholarly.search_author(' Steven A Cholewiak' ))
520508 scholarly.pprint(author)
521509
510+ ``ScraperAPI ``
511+ ^^^^^^^^^^^^^^
512+ pg.ScraperAPI()
513+ ###############
514+
515+ .. code :: python
516+
517+ from scholarly import scholarly, ProxyGenerator
518+
519+ pg = ProxyGenerator()
520+
521+ You will have to provide your ScraperAPI key
522+
523+ .. code :: python
524+
525+ success = pg.ScraperAPI(YOUR_SCRAPER_API_KEY )
526+
527+ Or alternatively you can use the environment variables as in the case of Luminati example.
528+
529+ If you have Startup or higher paid plans, you can use additional options that are allowed for your plan.
530+
531+ .. code :: python
532+
533+ success = pg.ScraperAPI(YOUR_SCRAPER_API_KEY , country_code = ' fr' , premium = True , render = True )
534+
535+ See https://www.scraperapi.com/pricing/ to see which options are enable for your plan.
536+
537+ Finally, you can route your query through the ScraperAPI proxy
538+
539+ .. code :: python
540+
541+ scholarly.use_proxy(pg)
542+
543+ author = next (scholarly.search_author(' Steven A Cholewiak' ))
544+ scholarly.pprint(author)
545+
546+ ``FreeProxies ``
547+ ^^^^^^^^^^^^^^^^^^^^
548+ pg.FreeProxies()
549+ ################
550+
551+ This uses the ``free-proxy `` pip library to add a proxy to your
552+ configuration.
553+
554+ .. code :: python
555+
556+ from scholarly import scholarly, ProxyGenerator
557+
558+ pg = ProxyGenerator()
559+ success = pg.FreeProxies()
560+ scholarly.use_proxy(pg)
561+
562+ author = next (scholarly.search_author(' Steven A Cholewiak' ))
563+ scholarly.pprint(author)
564+
522565 ``SingleProxy ``
523566^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
524567pg.SingleProxy(http: str, https:str)
@@ -531,7 +574,7 @@ If you want to use a proxy of your choice, feel free to use this option.
531574 from scholarly import scholarly, ProxyGenerator
532575
533576 pg = ProxyGenerator()
534- pg.SingleProxy(http = < your http proxy> , https = < your https proxy> )
577+ success = pg.SingleProxy(http = < your http proxy> , https = < your https proxy> )
535578 scholarly.use_proxy(pg)
536579
537580 author = next (scholarly.search_author(' Steven A Cholewiak' ))
@@ -556,7 +599,8 @@ the working directory of the ``test_module.py`` as:
556599
557600 Define the connection method for the Tests, among these options:
558601
559- - luminati (if you have a luminati proxy service)
602+ - luminati (if you have a Luminati proxy service)
603+ - scraperapi (if you have a ScraperAPI proxy service)
560604- freeproxy
561605- tor
562606- tor\_ internal
0 commit comments