Skip to content
This repository was archived by the owner on May 29, 2020. It is now read-only.
This repository was archived by the owner on May 29, 2020. It is now read-only.

Cannot use with RespectfulRequester #2

Open
@janmyszkier

Description

@janmyszkier

Sample code:

class FirstWebDriverTest(unittest.TestCase):

  def setUp(self):

    #initialize Webdriver with Request Limit
    self.driver = RespectfulWebdriver(webdriver=webdriver.Chrome())
    self.driver.register_realm("Shopify", max_requests=2, timespan=1)

    #setup Requests in same reals to figure out error code of the site without exceeding the limit
    self.rr = RespectfulRequester()
    self.rr.register_realm("Shopify", max_requests=2, timespan=1)

  def test_check_statuses(self):
    url = 'https://someshopify.myshopify.com/somepage'
    r = self.rr.get(url, realms=["Shopify"], wait=True, allowRedirects=False)
    print(r.status_code)

    if(r.status_code == 200):
      driver = self.driver
      driver.get(url, realms=["Shopify"], wait=True)

  def tearDown(self):
    self.driver.close()

if __name__ == '__main__':
	unittest.main()

When I do not use requests_respectful the RespectfulWebdriver is working nice, but if I want to force the same limit on both RespectfulWebdriver and RespectfulRequester then the RespectfulWebdriver doesn't even load the page. Browser opens, but it keeps waiting and waiting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions