pycontribs / pyrax

The Python SDK for the Rackspace Cloud
developer.rackspace.com
Apache License 2.0
237 stars 208 forks source link

requests 2.11.0 breaks pyrax ttl #615

Open danandersonasc opened 8 years ago

danandersonasc commented 8 years ago

requests 2.11.0 release a few days ago changed outgoing header validation. Now it is not possible for pyrex to set X-Delete-After to an integer value.

  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 2688, in store_object
    headers=headers, metadata=metadata)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 2758, in create_object
    metadata=metadata, headers=headers, return_none=return_none)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 78, in _wrapped
    return fnc(self, container, *args, **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 1377, in create_object
    return_none=return_none)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 430, in create
    return_none=return_none)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 1863, in create
    chunk_size, headers)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 1901, in _upload
    chunked=chunked, chunk_size=chunk_size, headers=headers)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/object_storage.py", line 1943, in _store_object
    headers=headers)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/client.py", line 260, in method_put
    return self._api_request(uri, "PUT", **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/client.py", line 231, in _api_request
    resp, body = self._time_request(safe_uri, method, **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/client.py", line 193, in _time_request
    resp, body = self.request(uri, method, **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/client.py", line 184, in request
    resp, body = pyrax.http.request(method, uri, *args, **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/pyrax/http.py", line 63, in request
    resp = req_method(uri, data=data, **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/requests/api.py", line 123, in put
    return request('put', url, data=data, **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/opt/test/ve/lib/python2.7/site-packages/requests/sessions.py", line 457, in request
    prep = self.prepare_request(req)
  File "/opt/test/ve/lib/python2.7/site-packages/requests/sessions.py", line 390, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/opt/test/ve/lib/python2.7/site-packages/requests/models.py", line 295, in prepare
    self.prepare_headers(headers)
  File "/opt/test/ve/lib/python2.7/site-packages/requests/models.py", line 409, in prepare_headers
    check_header_validity(header)
  File "/opt/test/ve/lib/python2.7/site-packages/requests/utils.py", line 756, in check_header_validity    "not %s" % (value, type(value)))
InvalidHeader: Header value 1800 must be of type str or bytes, not <type 'int'>
ollandos commented 7 years ago

Facing the same issue here. Any workaround?

drewbrew commented 5 years ago

Do you still see this with requests 2.21?