Python 3.8.10 error: got an unexpected keyword argument 'allowed_methods'

Hi There,

Using Python 3.8.10 on Ubuntu, and running into a peculiar problem for a simple code:

from square.client import Client
import os

client = Client(

result = client.locations.list_locations()

if result.is_success():
    for location in result.body['locations']:
        print(f"{location['id']}: ", end="")
        print(f"{location['name']}, ", end="")
        print(f"{location['address']['address_line_1']}, ", end="")

elif result.is_error():
    for error in result.errors:


python3 Traceback (most recent call last):
File β€œ”, line 4, in
client = Client(
File β€œ/usr/local/lib/python3.8/dist-packages/square/”, line 234, in init
self.config = Configuration(
File β€œ/usr/local/lib/python3.8/dist-packages/square/”, line 68, in init
File β€œ/usr/local/lib/python3.8/dist-packages/square/”, line 103, in create_http_client
return RequestsClient(
File β€œ/usr/local/lib/python3.8/dist-packages/apimatic_requests_client_adapter/”, line 40, in init
self.create_default_http_client(timeout, cache, max_retries,
File β€œ/usr/local/lib/python3.8/dist-packages/apimatic_requests_client_adapter/”, line 69, in create_default_http_client
retries = Retry(total=max_retries, backoff_factor=backoff_factor,
TypeError: init() got an unexpected keyword argument β€˜allowed_methods’

Any suggestions as to why such error is occurring? Its occurring at the client connection phase.

I’m reaching out to the team about this. :slightly_smiling_face:

1 Like

Any update on this issue?

@getblokfarm, The team was able to reproduce the issue with an outdated version of urllib3 , which they suspect is the issue. Can you please run pip install -U urllib3 to upgrade the package? :slightly_smiling_face:

That worked! Thank you!

# pip install -U urllib3
Collecting urllib3
  Downloading urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 140 kB 22.0 MB/s
Installing collected packages: urllib3
# python3
XXXXXXXXXXX: Default Test Account, 1600 Pennsylvania Ave NW, Washington

Glad to hear it worked. :slightly_smiling_face: