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

Cannot use with RespectfulRequester #2

Open
janmyszkier opened this issue Feb 19, 2019 · 1 comment
Open

Cannot use with RespectfulRequester #2

janmyszkier opened this issue Feb 19, 2019 · 1 comment

Comments

@janmyszkier
Copy link

janmyszkier commented Feb 19, 2019

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.

@janmyszkier
Copy link
Author

@nbrochu is this something you can look into?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant