Comments (9)
Hello,
Maybe it's the order the decorator, try:
@jsonrpc.method('addSession')
@crossdomain(origin='*', methods=['GET', 'OPTIONS', 'POST'])
def addSession(params):
...
Thank you.
from flask-jsonrpc.
When i'm change order, i have error when try to connect via python console and jsonrpclib (as serverProxy).
AppError Traceback (most recent call last)
<ipython-input-57-e2ed3d81507c> in <module>()
----> 1 jsonrpclib.Server('http://0.0.0.0:8099/statsApi').random()
/usr/local/lib/python2.7/dist-packages/jsonrpclib/jsonrpc.pyc in __call__(self, *args, **kwargs)
559 return self.__send(self.__name, args)
560 else:
--> 561 return self.__send(self.__name, kwargs)
562
563 def __getattr__(self, name):
/usr/local/lib/python2.7/dist-packages/jsonrpclib/jsonrpc.pyc in _request(self, methodname, params, rpcid)
437 config=self._config)
438 response = self._run_request(request)
--> 439 check_for_errors(response)
440 return response['result']
441
/usr/local/lib/python2.7/dist-packages/jsonrpclib/jsonrpc.pyc in check_for_errors(result)
1117 # Application error
1118 data = result['error'].get('data', None)
-> 1119 raise AppError((code, message, data))
1120
1121 elif isinstance(result['error'], dict) and len(result['error']) == 1:
AppError: (200, u'OtherError: 200 OK', None)
and in browser i also don't have "Access-Control-Allow-Origin header" in response.
from flask-jsonrpc.
with flask_jsonrpc.proxy.ServiceProxy i have error also
{u'error': {u'code': 200,
u'data': None,
u'message': u'OtherError: 200 OK',
u'name': u'OtherError'},
u'id': u'f42a81d2-aee3-11e4-8295-08606ee7f025',
u'jsonrpc': u'2.0'}
from flask-jsonrpc.
i'm understand that problem in
make_response(f(*args, **kwargs))
from http://flask.pocoo.org/snippets/56/ decorator. This return a new response, but flask-jsonrpc wait not response, only result of function.
Problem how to transfer headers from another decorator to flask-jsonrpc, if flask-jsonrpc doesn't wait a response object...
from flask-jsonrpc.
I understand, would have to add the decorators list to be processed by the JSONRPC.
A while ago there was a pull request[#21] to accomplish this task. At the time, I thought was very intrusive, but now need to think better.
Thank you.
from flask-jsonrpc.
Thx for response, i will waiting
from flask-jsonrpc.
Instead of using the decorator from the snippet, you can try the Flask-CORS extension. At least it worked for me to have the header automatically added to all routes.
from flask-jsonrpc.
It added support to designers that alter the response.
Look at the example decorator[1] for more details.
Note: To use this feature has added a helpers make_response
(from flask_jsonrpc make_response import).
Fixed in version 0.3.
[1] - https://github.com/cenobites/flask-jsonrpc/blob/v0.3/examples/decorator/decorator.py#L70
Thank you.
from flask-jsonrpc.
Nice work!
from flask-jsonrpc.
Related Issues (20)
- werkzeug.exceptions.BadRequest (400) is converted to internal server error (500) HOT 1
- App.wellcome() is visible in Dashboard but unaccessible? HOT 2
- Directories in API browser HOT 8
- Feature reqest: do not allow to invoke method as JSON-RPC "Notification" HOT 2
- API browser does not work with flask-jwt HOT 4
- API browser does not support more complex type anotations
- Default values for parameters in API Browser HOT 3
- Feature request: package description and package documentation page
- Feature request: Markdown/HTML support for descriptions HOT 2
- Allow to use custom error codes for unexpected errors HOT 1
- Feature request: use Annotated type hint for per-field documentation HOT 2
- Feature request: allow deeper view nesting in API Browser HOT 2
- Feature request: function (view) overloading? HOT 6
- The API Browser doesn't support method without types hints
- Unified API Browser in case of using modular server
- Add support to Python 3.11
- Goodbye Python 3.6
- JSON Schema Service Descriptor
- Can not import in windows HOT 1
- remove support for 3.7 and 3.8 and add 3.12 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-jsonrpc.