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

Server-Side HTTP Client #100

Open
ZeroIntensity opened this issue Nov 29, 2023 · 3 comments
Open

Server-Side HTTP Client #100

ZeroIntensity opened this issue Nov 29, 2023 · 3 comments
Labels
api This has to do with the Python API (view) c api This has to do with the C API (_view) delayed Delayed due to another issue feature New feature

Comments

@ZeroIntensity
Copy link
Owner

Feature description

NextJS has their own way of handling fetching from servers by caching the request. It shouldn't be super hard to implement this for view.

Feature example API

from view import new_app

app = new_app()

@app.get("/")
async def index():
    res = await app.http.get("https://google.com")
    ...
app.run()

OR, a utility that calls get_app internally

from view import get, http

client = http()

@get("/")
async def index():
    res = await client.get("https://google.com")
    ...

Anything else?

No response

@ZeroIntensity ZeroIntensity added good first issue An issue that isn't necessarily easy to implement, but not required to be an expert in view.py feature New feature api This has to do with the Python API (view) labels Nov 29, 2023
@ZeroIntensity ZeroIntensity added the delayed Delayed due to another issue label Dec 27, 2023
@ZeroIntensity
Copy link
Owner Author

Waiting on #12

@ZeroIntensity ZeroIntensity added c api This has to do with the C API (_view) and removed good first issue An issue that isn't necessarily easy to implement, but not required to be an expert in view.py labels Dec 30, 2023
@ZeroIntensity
Copy link
Owner Author

This is no longer a beginner issue. This should involve the PyAwaitable API (details in #19) and likely implement HTTP internally. This is also now waiting on #109.

This will involve OS API's in C, so some macro magic might be needed in order to make it cross platform.

@ZeroIntensity
Copy link
Owner Author

On a second thought, reimplementing HTTP is probably a terrible idea. cURL could be shipped with view.py for an HTTP client. This might cause some blocking I/O problems, though.

It might be a good idea to forget about implementing this in C - using aiohttp and just adding caching to it could be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api This has to do with the Python API (view) c api This has to do with the C API (_view) delayed Delayed due to another issue feature New feature
Projects
None yet
Development

No branches or pull requests

1 participant