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

Implement "URL fopen"-like behavior. #16

Open
amcgregor opened this issue Mar 24, 2021 · 0 comments
Open

Implement "URL fopen"-like behavior. #16

amcgregor opened this issue Mar 24, 2021 · 0 comments

Comments

@amcgregor
Copy link
Member

amcgregor commented Mar 24, 2021

Implement Basic Socket Streams

  • Raw TCP communication via tcp:// pseudo-protocol; port identification required.
  • Raw UDP communication via udp:// pseudo-protocol; port identification required.

Protocol Layering

SSL or TLS cryptography through addition of +ssl or +tls protocol suffixes.

Specific Protocol Implementations

HTTP

https://docs.python.org/3/library/urllib.request.html
https://docs.python.org/3/library/http.client.html#module-http.client

class HTTPScheme(Scheme):
	def open(self, uri:URI, mode:str='r', buffering=-1, encoding=None, errors=None, newline=None) -> HTTPResponse:
		...

FTP

https://docs.python.org/3/library/ftplib.html

Trivial Example

from uri import URI
from PIL import Image

with URI('https://httpbin.org/image/png').open('rb', True) as fh:
	image = Image.open(fh)
	...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant