Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bfaludi/uniopen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uniopen (Universal Opener)

It's so simple. You can open things with it, that's the story. Nothing more. It works with Python 2 and 3 as well.

Let's see the magic

Open a local file:

with uniopen.Open('file.csv', 'r', encoding = 'utf-8') as rs:
	print(rs.read())

Open an URL:

with uniopen.Open('http://goo.gl/7XZsrO') as rs:
	print(rs.read())

Open a Database connection:

with uniopen.Open('postresql://username:password@host:port/dbname') as rs:
	print(rs.execute('SELECT * FROM table_name;'))

... even in Amazon Redshift:

with uniopen.Open('redshift://username:password@endpoint:port/database') as rs:
	print(rs.execute('SELECT * FROM table_name;'))

Open a file via SSH connection:

with uniopen.Open('ssh://username:password@host:port/home/username/example/file.csv', 'r') as rs:
	print(rs.read())

Open a file in Amazon S3 bucket:

with uniopen.Open('s3://key_id:secret_key@bucket/file.csv') as rs:
	print(rs.read())

Open a file in HFDS:

with uniopen.Open('hdfs://user/hadoop/file.csv') as rs:
	print(rs.read())          

Enjoy!

About

Universal File Opener

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages