MediaMath / t1-python

Python SDK for MediaMath Platform APIs
https://developer.mediamath.com/
Apache License 2.0
18 stars 30 forks source link

Reports unicode #75

Closed FodT closed 8 years ago

FodT commented 8 years ago

this is a potential fix for issue #63 the csv module in python 2.7 isn't very well behaved. Introduce an explicit handler for python 2.7 comments welcome.

pswaminathan commented 8 years ago

We're already decoding the response in the line as the get call. Let's just avoid doing anything there and then decode if it's Python 3. Or better, just make the decode_unicode argument a Python 2/3 variable. Better than having a separate stack frame for it.

pswaminathan commented 8 years ago

@FodT can you test pswaminathan/FodT-reports-unicode@4e55ecb6510e310a81ca37a826465e5852753816 and see if that works? There was a merge conflict here and I made a Python2/3 flag for decode_unicode. Passing all tests for me.

FodT commented 8 years ago

I ran into one problem with python setup.py test - six 1.10.0 was brought in by mock (which is brought in by responses) and this does not contain the decorator wraps. I think we need to pin the dependency versions in the requirements.

======================================================================
ERROR: test_collection (tests.test_gets.TestGets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 2, in wrapper
  File "/Library/Python/2.7/site-packages/responses.py", line 177, in __enter__
    self.start()
  File "/Library/Python/2.7/site-packages/responses.py", line 291, in start
    import mock
  File "/Library/Python/2.7/site-packages/mock/__init__.py", line 2, in <module>
    import mock.mock as _mock
  File "/Library/Python/2.7/site-packages/mock/mock.py", line 68, in <module>
    from six import wraps
ImportError: cannot import name wraps

is there a reason we package six rather than bringing it in as a (pinned) requirement?

Other than that, all seems OK.