Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Michael Wheeler
    @mikewheel
    ^^^ideally without having to know the absolute URI of the app
    Michael Wheeler
    @mikewheel
    Never mind, I solved my problem by writing a WSGI harness to use within the on_post() method of the outer endpoint. For anyone who's curious I followed the example code at the bottom of this blog post
    Kurt Griffiths
    @kgriffs
    Glad you were able to get that sorted; we hope to make this easier in the future by adding some helper functions.
    @vytas7 @nZac ^^^
    lipeng1991
    @lipeng1991
    I want to know how to parse the content-type parameter for form-data. I use the parse_qsl method to parse the body, but the result for me is always not as expected. What should I do?
    thankyou
    image.png
    but if i use the x-www-form-urlencoded ,it is ok
    Kurt Griffiths
    @kgriffs
    @lipeng1991 Just to clarify, are you asking how to parse a multipart/form-data body? Also, could you share an example request body that is failing to parse correctly, and also include what you are getting vs. what is expected? (You can use GitHub gists or something similar if you like).
    Pinging @vytas7 since he is in the middle of revamping form handling for Falcon 3.0
    lipeng1991
    @lipeng1991
    @kgriffs yeah, i will give you the example.
    lipeng1991
    @lipeng1991
    image.png
    image.png
    The above is the output, the following is the code
    Kurt Griffiths
    @kgriffs
    @lipeng1991 OK, that looks like multipart. @vytas7 is working on adding native, optimized support for that in the next version of Falcon (3.0) but in the meantime you can use cgi.FieldStorage from the standard library: https://gist.github.com/kgriffs/7db18102a2051cfaa60503638d3af673
    (TBH I didn’t test the code in that gist, but it should work)
    lipeng1991
    @lipeng1991
    @kgriffs thanks
    Kurt Griffiths
    @kgriffs
    sure thing!
    mostafa khaki
    @mosi-kha
    hi , don't resources' functions support routing argument as *args?
    for example
    def on_post(self, req, resp, *args)
        pass
    
    add_rout('test/{id}') ...
    Vytautas Liuolia
    @vytas7

    @mosi-kha However noble your cause is, I'm not sure if this channel is a right place for spreading campaigns like that.

    @mosi-kha And to answer your question about the arguments, no, that is currently not supported.

    Methods like on_post in your example are invoked as (see the source code for falcon.API.__call__):

    responder(req, resp, **params)
    If you defined on_post as
    def on_post(self, req, resp, **kwargs):
        ...
    That should do the job.
    mostafa khaki
    @mosi-kha
    @vytas7 thanks for your awnser
    dan-bar-dov
    @dan-bar-dov
    Is there a way to specify a callback after all responders? I prefer not to have to add a @after on all responders
    dan-bar-dov
    @dan-bar-dov
    Will a middleware component that has only a process_response method do the trick:
    class MiddlewareComponent:
        def process_response(self, req, resp, resource, req_succeeded):
            db = DatabaseAdapter()
            db.session.expire_all()
    Mert Simsek
    @_mertsimsek_twitter
    Hi everyone, I'm new one here and with Falcon Framework also with Python :)
    I've just published a blog post to run on Docker for Falcon Framework.
    It might be useful or helpful for someone.
    Boyong Nangwei Lambert
    @bnlambert_gitlab
    Thank you for sharing @_mertsimsek_twitter
    Kurt Griffiths
    @kgriffs
    @dan-bar-dov sorry for the delayed response. Yes, you can use a middleware component for that. Were you able to get it to work?
    dan-bar-dov
    @dan-bar-dov
    Yes, it works. Thanks.
    Cylkal
    @Cylkal
    Can Falcon first response to request then execute other code?I'm sorry that I can't find a method to response immediately and then execute other time consuming codes.
    Tomas Rasymas
    @tomasrasymas
    Hello, I am implementing Facebook login. Trying to implement schema as displayed https://stackoverflow.com/questions/52806946/python-oauth2-server-with-social-networks-for-a-restfull-api. But maybe there are falcon libraries that already implements all that login flow? Or maybe there are any tutorials how to implement that? Thanks in advance!
    Kurt Griffiths
    @kgriffs
    Hi @tomasrasymas, it's been a while since I've checked, but IIRC there are a few OAuth packages floating around for Falcon. I would just google "falcon oauth2" (etc.) and see what comes up.
    FWIW, at this past PyCon US, I met with the other core maintainers and we discussed the possibility of maintaining a set of particularly useful packages to address common use cases like OAuth. However, we haven't made a decision on this yet, because we want to be careful not to stifle innovation in the community, and also to be sure that we have grown the maintainers team sufficiently that we have the bandwidth to maintain additional projects.
    TL;DR: For now we are still reliant on the community for "batteries" like OAuth, but that isn't necessarily a bad thing. :D
    Tomas Rasymas
    @tomasrasymas
    Ok, will look for community stuff :)
    Kurt Griffiths
    @kgriffs
    Let me know if there doesn't seem to be anything out there that is well-maintained.
    well-maintained/meets your needs
    @vytas7 FYI ^^^
    Tomas Rasymas
    @tomasrasymas
    Sure!
    Kurt Griffiths
    @kgriffs
    Hi @Cylkal, I commented on your issue.
    Tomas Rasymas
    @tomasrasymas
    Hello, create sample restful API project -> https://github.com/tomasrasymas/falcon-restful-api-boilerplate. Take a look, any feedback is welcome!
    Kurt Griffiths
    @kgriffs
    Nice, thanks for sharing!
    Vytautas Liuolia
    @vytas7
    @tomasrasymas looks awesome, šaunu ! If I were to nitpick, not sure if that require_json middleware was necessary, the same (at least the POST / PUT branch) should be achievable OoB with Falcon's media framework unless I missed something important.
    Tomas Rasymas
    @tomasrasymas
    Thanks @vytas7 ! Removed my custom content-type checking and left Falcon's default one.