Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests Blocked by CORS #719

Open
i1Fury opened this issue Jan 26, 2022 · 4 comments
Open

Requests Blocked by CORS #719

i1Fury opened this issue Jan 26, 2022 · 4 comments

Comments

@i1Fury
Copy link

i1Fury commented Jan 26, 2022

It isn't 100% clear to me how to write a flexx app based around asyncio.
I read through:

  1. asyncio support #373
  2. Flexx refactoring for better scaling #408
  3. Allow using cocoutines (and await) in actions #413
    Was async ever integrated directly into flexx? I couldn't find the commit :P
@i1Fury
Copy link
Author

i1Fury commented Jan 27, 2022

Update:
I managed to get several asynchronous versions working, but I can for the life of me send a request to an external API. For starters, most request packages for python cant be compiled by PScript. Also, flexx uses a browser so it follows CORS. It blocks all requests to other domains. How am I supposed to build my app that relies on an API(like a lot of apps do), if the UI is blended in with the backend? Is there a way I can have a backend to the UI running that isn't compiled by PScript nor blocked by CORS?

@i1Fury i1Fury changed the title Async example Requests Blocked by CORS Jan 27, 2022
@gwingnhbc
Copy link

gwingnhbc commented Jan 27, 2022 via email

@i1Fury
Copy link
Author

i1Fury commented Jan 27, 2022

I switched to Neutralino using a python backend extension, i like it a lot better than Flexx at it's current state after messing around with Flexx for about 6h. I am gonna keep a close eye on this project because when it comes out of beta it'll be fire.

@almarklein
Copy link
Member

I managed to get several asynchronous versions working, but I can for the life of me send a request to an external API. For starters, most request packages for python cant be compiled by PScript. Also, flexx uses a browser so it follows CORS.

The tricky part with Flexx is that both the server and client code are in Python, so the look alike a lot. You have to be careful to separate that in your application. Also see the word of caution in the readme. On the server side (e..g. in PyWidget's) you can use the Python async constructs, and you could send requests with e.g. responder or httpx (both are async). On the client side (in most other widgets) you're actually writing JavaScript (via PScript), and you can use JavaScript requests. And yes, you are subject to the browser's security constraints.

I am gonna keep a close eye on this project because when it comes out of beta it'll be fire.

To be honest, I am not actively developing Flexx anymore, so it will probably take a new developer to pull this out of beta, if ever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants