uri icon indicating copy to clipboard operation
uri copied to clipboard

Implement "URL fopen"-like behavior.

Open amcgregor opened this issue 3 years ago • 0 comments

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)
	...

amcgregor avatar Mar 24 '21 04:03 amcgregor