simperium / simperium-python Goto Github PK
View Code? Open in Web Editor NEWSimperium client library for Python
License: MIT License
Simperium client library for Python
License: MIT License
This library is not compatible with python3. Discovered this while beginning to port sncli to the simperium api.
Would there be any interest from Simperium to add python 3 support? With the current setup it could require a fair bit of work to support both with the current setup - perhaps it would be worth having a second repo simperium-python3
or similar?
Porting would involve:
requests
library instead?Calling it from the python REPL returns a 404, and attempts at querying it with cURL do as well. Has the endpoint been removed from the server?
This is vexing as there are no other ways for a non-admin user to sync changes across clients via HTTP.
(ins)>>> from simperium.core import Auth, Api
(ins)>>> auth = Auth('xxx, 'xxx')
(ins)>>> token = auth.authorize('xxx', 'xxx')
(ins)>>> api.todo.index()
{u'current': u'5a92faf5d9b5bb1d2d05a3b6', u'index': [{u'id': u'91faf5558dc8cb57c367', u'v': 3}]}
(ins)>>> api.todo.changes()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "simperium/core.py", line 282, in changes
response = self._request(url, headers=headers, timeout=timeout)
File "simperium/core.py", line 120, in _request
response = urllib2.urlopen(request, timeout=timeout)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 435, in open
response = meth(req, response)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 548, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 473, in error
return self._call_chain(*args)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 556, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
Bucket.delete
gives me a 400 bad request response. I did some digging, and I get a bad request with everything I try using DELETE. For example:
❯ curl -H 'X-Simperium-Token: REDACTED' -X DELETE \
https://api.simperium.com/1/redacted/note/i/myredactedid
<html><title>400: Bad Request</title><body>400: Bad Request</body></html>
~
❯ curl -H 'X-Simperium-Token: REDACTED' -X GET \
https://api.simperium.com/1/redacted/note/i/myredactedid
{"tags": ["Thing", ... // snip
Am I using it wrong or misreading the docs? I tested with curl
following the http docs for the simplenote app (shown above), as well as this python library.
In bulk_post of Bucket class, you're making request to changes
endpoint, but I couldn't find it on Simperium HTTP doc. I'm writing a client with a method to send buffered entities at once, pretty much like bulk_post
. Would be good to have reference for that endpoint (like available query params and expected responses).
This is merely a question not an issue with this Python wrapper.
As stated in Simperium HTTP doc there's: update
, reset_password
, and delete
. Is there consideration for not supporting this under Python library?
Tried to install as one of the requirements for sncli
with following command:
pip install git+https://github.com/swalladge/simperium-python3.git#egg=Simperium3 --user
Downloading/unpacking Simperium3 from git+https://github.com/swalladge/simperium-python3.git
Cloning https://github.com/swalladge/simperium-python3.git to /tmp/pip-build-v4xf4wpi/Simperium3
Running setup.py (path:/tmp/pip-build-v4xf4wpi/Simperium3/setup.py) egg_info for package Simperium3
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
error in Simperium3 setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
Complete output from command python setup.py egg_info:
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
error in Simperium3 setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-v4xf4wpi/Simperium3
Storing debug log for failure in /home/user/.pip/pip.log
What do I miss?
Regards,
Zaxon
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.