Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify with python 3.5.1 #399

Closed
krishnasrinivas opened this issue Aug 27, 2016 · 1 comment · Fixed by #400
Closed

Verify with python 3.5.1 #399

krishnasrinivas opened this issue Aug 27, 2016 · 1 comment · Fixed by #400

Comments

@krishnasrinivas
Copy link
Contributor

@xtream1101 reported issue with set policy in python 3.5.1:

File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio/api.py", line 361, in set_bucket_policy
    bucket_name, prefix)
  File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio/policy.py", line 496, in set_policy
    append_statements(out, ns)
  File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio/policy.py", line 372, in append_statements
    _append_statement(statements, s)
  File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio/policy.py", line 356, in _append_statement
    _get_action(s) == _get_action(statement) and
  File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio/policy.py", line 57, in _get_action
    if isinstance(action, basestring):
NameError: name 'basestring' is not defined
  File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio-2.0.0-py3.5.egg/minio/api.py", line 372, in set_bucket_policy
  File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio-2.0.0-py3.5.egg/minio/helpers.py", line 417, in get_md5
TypeError: Unicode-objects must be encoded before hashing
File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/scrapers/__init__.py", line 124, in <module>
    'data')
  File "/Users/eddyhintze/Virtualenvs/py3/py3/lib/python3.5/site-packages/minio-2.0.0-py3.5.egg/minio/api.py", line 372, in set_bucket_policy
TypeError: string argument without an encoding
@krishnasrinivas
Copy link
Contributor Author

@xtream1101 reported this:

Tested with python2.7.10 & python 3.4.3 & python 3.5.1 and got different errors with each (with fresh repo pull as well as with the changes applied). I was using this code snippet to test with:
from minio import Minio
from minio.policy import Policy

host = ''
access_key = ''
secret_key = ''

s3 = Minio(host,
           access_key=access_key,
           secret_key=secret_key,
           secure=True)

bucket_name = 'test1'

# Check if bucket exists, if not create it
if s3.bucket_exists(bucket_name) is False:
    s3.make_bucket(bucket_name, location="us-east-1")

s3.set_bucket_policy(Policy.READ_ONLY,
                     bucket_name,
                     'data')

harshavardhana added a commit to harshavardhana/minio-py that referenced this issue Aug 28, 2016
Also fix the API set_bucket_policy() should take input
policy as the last option and API should be consistent
with other languages.

This patch also adds a functional test case.

Fixes minio#399
harshavardhana added a commit to harshavardhana/minio-py that referenced this issue Aug 31, 2016
Also fix the API set_bucket_policy() should take input
policy as the last option and API should be consistent
with other languages.

This patch also adds a functional test case.

Fixes minio#399
harshavardhana added a commit to harshavardhana/minio-py that referenced this issue Aug 31, 2016
Also fix the API set_bucket_policy() should take input
policy as the last option and API should be consistent
with other languages.

This patch also adds a functional test case.

Fixes minio#399
harshavardhana added a commit that referenced this issue Aug 31, 2016
Also fix the API set_bucket_policy() should take input
policy as the last option and API should be consistent
with other languages.

This patch also adds a functional test case.

Fixes #399
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants