A Python package to expose local files through a public URL using ngrok
Project description
remote-expose
A Python package that allows you to easily expose local files through a public URL using ngrok.
Installation
pip install remote-expose
Usage
from remote_expose import exposeRemote, exposeRemoteAsync
# Synchronous usage with context manager
with exposeRemote('path/to/your/file.txt') as url:
print(f"Your file is available at: {url}")
# The file will be accessible at the URL while in this context
# Once the context is exited, the tunnel will be closed if no other files are being exposed
# Multiple files can be exposed simultaneously
with exposeRemote('file1.txt') as url1, exposeRemote('file2.txt') as url2:
print(f"File 1 is at: {url1}")
print(f"File 2 is at: {url2}")
# Async usage with async context manager
import asyncio
async def expose_files():
async with exposeRemoteAsync('file1.txt') as url1, \
exposeRemoteAsync('file2.txt') as url2:
print(f"File 1 is at: {url1}")
print(f"File 2 is at: {url2}")
await asyncio.sleep(60) # Keep files exposed for 60 seconds
# Run the async function
asyncio.run(expose_files())
Features
- Easy-to-use context manager interface
- Async support with async context manager
- Automatic resource cleanup
- Support for exposing multiple files simultaneously
- Secure file serving (no directory listing)
- Thread-safe implementation
- Automatic port management
- Efficient resource sharing (single server for multiple files)
Requirements
- Python 3.7+
- ngrok account (free tier works fine)
- pyngrok
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
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
remote_expose-0.0.3.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file remote_expose-0.0.3.tar.gz.
File metadata
- Download URL: remote_expose-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7639dbb009d0b5b7b481a94c4c579d8a6152e2ef114617596cec7375ad5e28f
|
|
| MD5 |
3fa41bf1997052cff9d66e42922c9e98
|
|
| BLAKE2b-256 |
3df004d01821c1eba9829f6f56f5d38f129a5976d64c616b36cac27a1ca58e28
|
File details
Details for the file remote_expose-0.0.3-py3-none-any.whl.
File metadata
- Download URL: remote_expose-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd6a88bd59be0ca57118b9917c9ef139f439dc501d7c388ccaaf571bee8bc10c
|
|
| MD5 |
26367b2ffa87a41b716056b230ea649d
|
|
| BLAKE2b-256 |
b99aa29c6ce09dfa2c99e4c112de20a078ac4d78214e593a3c3c73d002cc29f4
|