algoliasearch-client-python: Bad write retry error with python 2.7.10

When I try to execute

def test_network(self):
        batch = []
        for i in range(1, 3000):
            batch.append({'action': 'addObject', 'body': {
                'test1': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
            }})
        self.index.batch(batch)

I receive the error: AlgoliaException: Unreachable hosts: {‘YLGNV73XLW-2.algolianet.com’: “[(‘SSL routines’, ‘ssl3_write_pending’, ‘bad write retry’)]”, ‘YLGNV73XLW.algolia.net’: “[(‘SSL routines’, ‘ssl3_write_pending’, ‘bad write retry’)]”, ‘YLGNV73XLW-3.algolianet.com’: “[(‘SSL routines’, ‘ssl3_write_pending’, ‘bad write retry’)]”, ‘YLGNV73XLW-1.algolianet.com’: “[(‘SSL routines’, ‘ssl3_write_pending’, ‘bad write retry’)]”}

If I use python 3.4, the issue is fixed, it’s maybe related to https://hg.python.org/cpython/rev/60310223d075/

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Just to make it clear for people reading that issue later on:

  • the issue is indeed in urllib3 and has been fixed with https://github.com/shazow/urllib3/pull/719
  • BUT upgrading urllib3 won’t solve the issue because requests embed it’s own version of urllib3; so the API client won’t use that updated version
  • the good thing is that requests upgraded to urllib3 1.13 in their 2.9.x release

tldr;

pip install requests[security]==2.9.1