Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Antonio Di Mariano
    @antoniodimariano
    Basically, I am looking to run some before_method check, in order to validate the body or just check if a POST request has a payload.

    Using Flask I can define something like

    @self.app.before_request
            def before_request():
                if 'Authorization' not in request.headers:
                    abort(401)
                if request.method == 'POST':
                    if not request.json:
                        abort(400)

    I was wondering how I can do it with nameko

    Matt Yule-Bennett
    @mattbennett
    Hey @antoniodimariano. The exact equivalent of this would be to create a custom entrypoint that inherited from the built-in HTTP one, and modified the handle_request logic (see https://github.com/nameko/nameko/blob/master/nameko/web/handlers.py#L40)
    However, you may want to be more granular and check these things for certain entrypoints only. For that I would use a decorator around the service method that inspected the request object before maybe calling the wrapped method. There's an example of that here: https://github.com/nameko/nameko-amqp-retry/blob/master/nameko_amqp_retry/decorators.py#L30
    Someshwar Dash
    @someshwardash
    Hello everyone! Is using nameko as an api server recommended? Or stick to NodeJS/Flask?
    Antonio Di Mariano
    @antoniodimariano
    hey @someshwardash . Here I am
    I moved to nameko after a few years with Node.js
    so, I would rather say I am still in the 'learning mode'
    but happy to know that we are in the same boat
    so AFAIK nameko is a good solution, but I ‘ve not testing it in production yet
    Someshwar Dash
    @someshwardash
    I'm not really using Nameko as my API server, mainly using it for running smaller services for computations etc. Still using NodeJS as my primary API server. Although I do have a few APIs being served from Nameko which are suddenly giving me issues (Although the errors might be because I am missing something)
    Antonio Di Mariano
    @antoniodimariano
    yes, I see your point. I am still trying to figure out if node.js is better in terms of API server or python can raise the voice
    if you wanna share your piece of code,
    FoxMaSk
    @foxmask
    o/
    FoxMaSk
    @foxmask
    is there a way to dynamically define a RpcProxy of a service ? Because I don't know which service will depeend on anotyher one in advance. I made a project like IFTTT.com where you can plug service with each other but of course, you don't know what service will depend on another one
    or show I just use nameko.event instead of rpc ?
    Antonio Di Mariano
    @antoniodimariano
    I think you can go with nameko.event but
    how dinamically would you like to define a rpc?
    as soon as you plug in a new service you define a new proxy to use?
    FoxMaSk
    @foxmask
    i dont know :) i'm a beginner with nameko I search my path :)
    Antonio Di Mariano
    @antoniodimariano
    welcome :) I am more than a begineer with nameko
    ffs, I would like to have more documentation and more examples
    real use example I mean
    not the common stuff
    FoxMaSk
    @foxmask
    I agree
    Antonio Di Mariano
    @antoniodimariano
    in the end, nothing is simple in a microservices architecture so
    ...
    for exampe, anyone know how I can disable the debug message in nameko
    I am using the logging module
    but I have the console full of msgs like
    2017-12-19 15:35:46,472 nameko.containers DEBUG    signalling result for <WorkerContext [proxy.register_action] at 0x105ce79b0>
    tore down worker <WorkerContext [proxy.register_action] at 0x105ce79b0> in 0.000s
    FoxMaSk
    @foxmask
    i tested wamp.ws earlier ; I think I could find my marks but it's not trivial ; need time to test
    Antonio Di Mariano
    @antoniodimariano
    what’s about?
    in order to dinamically assign a proxy?
    FoxMaSk
    @foxmask
    or event_handler
    Matt Yule-Bennett
    @mattbennett
    @antoniodimariano, add a logging configuration to your config.yaml and set the level of the root logger there. example: http://nameko.readthedocs.io/en/stable/cli.html?highlight=logging#running-a-service
    Antonio Di Mariano
    @antoniodimariano
    thanks a lot.
    Matt Yule-Bennett
    @mattbennett
    @foxmask there is a recent thread on the mailing list exactly about dynamic RPC proxies: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/nameko-dev/XE-uarCEV00
    FoxMaSk
    @foxmask
    @mattbennett thanks a lot
    FoxMaSk
    @foxmask
    @mattbennett any other example about dynamic event_handler ? I would like to be able to use the decorator ; but with a new of a service I don't know yet. like in the example of dynamic RPC proxies
    FoxMaSk
    @foxmask
    i'm asking myself what's the concept of containers ... that's a service with specific config ? and about ServiceRunner ? what's the goal of runner.add_runner() ?
    runner.add_service() i meant
    Matt Yule-Bennett
    @mattbennett
    @foxmask no such example dynamic event handlers i'm afraid. wouldn't be too difficult to implement yourself though, if you study the existing event hander
    @foxmask re containers, yes -- the container is the thing that runs a singular service. it manages the extensions (entrypoints, dependency providers) declared by the service and creates workers when an entrypoint fires. the runner is just a convenience wrapper around one or more containers.
    FoxMaSk
    @foxmask
    the runner bootstraps services that are not necessary linked with each other ?
    Matt Yule-Bennett
    @mattbennett
    not sure what you mean by bootstrapping. it will just run any services that you ask it to, each in their own containers
    when you do nameko run <module> on the command line, nameko will discover any service classes defined in <module> and start them all under one runner
    FoxMaSk
    @foxmask
    ok
    Antonio Di Mariano
    @antoniodimariano
    Hi guys,
    I was wondering where I can find a nice guide to logging