Read http(s), multicast, and udp streams like files
Project description
new_reader
Read stdin
, files
, multicast
, udp
, and http(s)
URIs the same way.
from new_reader import reader
rdr = reader('udp://@235.35.3.5:3535')
rdr.read()
new_reader is used by threefive
, x9k3
, gumd
, m3ufu
, kabuki
, and iframes
.
How is new_reader.reader
used?
# print a mpegts packet header via https
>>>> from new_reader import reader
>>>> with reader('https://so.slo.me/longb.ts') as rdr:
.... packet = rdr.read(188)
.... print(packet[:4])
....
b'G@\x11\x10'
| more
-
Files
from new_reader import reader
with reader("/home/you/video.ts") as data:
fu = data.read()
-
HTTP(S)
from new_reader import reader
with reader('http://iodisco.com/') as disco:
disco.read()
# Add http headers like this
with reader('http://iodisco.com/',headers={"myHeader":"DOOM"}) as doom:
doom.read()
-
Multicast
from new_reader import reader
with reader("udp://@227.1.3.10:4310") as data:
data.read(8192)
-
UDP
from new_reader import reader
udp_data =reader("udp://1.2.3.4:5555")
chunks = [udp_data.read(188) for i in range(0,1024)]
udp_data.close()
UDP
and Multicast
- reader will set
socket.SO_RCVBUF
to twice the maximum value set in the OS forUDP
andMulticast
.- On
OpenBSD
sysctl net.inet.udp.recvspace
- On
Linux
sysctl net.core.rmem_max
- On
Windows
I.have.no.idea
- On
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
new_reader-0.1.5.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for new_reader-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66f6fc40fdf6c00c2993f2febc14bd1a597200d2c4b6025d34e8268ae7ed9265 |
|
MD5 | 84345bf7fed6aaf54dcd4cfb83b9d80e |
|
BLAKE2b-256 | 12127a6ddd1d6c9d9aca7f80380ad1cb91336b092d28bcaa8013bcf222cd0489 |