gicait / geoserver-rest

Python library for management of geospatial data in GeoServer.
https://geoserver-rest.readthedocs.io
MIT License
197 stars 79 forks source link

TypeError: requests.api.get() got multiple values for keyword argument 'auth' (in version 2.8.0) #160

Closed pesekon2 closed 4 months ago

pesekon2 commented 4 months ago

Running my code with version 2.8.0 instead of 2.7.0 fails with the following error message. Is there some change I need to do when transferring to the new version?

Traceback (most recent call last):
  File "/opt/scripts/create_layers.py", line 104, in <module>
    main(
  File "/opt/scripts/create_layers.py", line 29, in main
    datastores = geo.get_datastores(workspace=workspace)
  File "/usr/local/lib/python3.10/dist-packages/geo/Geoserver.py", line 478, in get_datastores
    r = self._requests("get", url, auth=(self.username, self.password))
  File "/usr/local/lib/python3.10/dist-packages/geo/Geoserver.py", line 171, in _requests
    return requests.get(url, auth=(self.username, self.password), **kwargs, **self.request_options)
TypeError: requests.api.get() got multiple values for keyword argument 'auth'

This is the code snippet that fails (at the last line). It works when I switch back to 2.7.0 but I would like to use the request_options (commented now).

    geo = Geoserver(
        url, username=username, password=password,
        # request_options={'timeout': timeout}
    )

    # create workspace
    workspaces = geo.get_workspaces()
    if workspace not in workspaces.keys():
        print('create workspace')
        geo.create_workspace(workspace=workspace)

    # create store
    datastores = geo.get_datastores(workspace=workspace)
iamtekson commented 4 months ago

Thank you @pesekon2 for reporting this issue. Yes, I just saw this issue in our code block. Please install v2.8.1 to fix this issue.

pesekon2 commented 4 months ago

@iamtekson: Yes, tested and works now. Thank you.