Skip to main content

Replace local files with code from a pastebin link

Project description

pastebin-replace

Small, simple python package to replace a file with raw code from Pastebin.

Installation

From Source

pip install .

With pip (PyPI)

pip install pastebin-replace

Usage

Within Python Script

pbreplace(path, link)

Terminal

pbreplace <path> <link>

Example

Suppose you have an empty file named test.txt located in C:\Users\Yourname\Downloads\test.txt. And you know a public Pastebin https://pastebin.com/hcv2WRnX containing some text. You want the content of test.txt to be like the text on the Pastebin link.

You can write this with Python:

from pastebin_replace import pbreplace

pbreplace(r"C:\Users\Yourname\Downloads\test.txt", "https://pastebin.com/hcv2WRnX")

Or directly from terminal:

pbreplace C:\Users\Yourname\Downloads\test.txt https://pastebin.com/hcv2WRnX

Note

Replaced file can't be recovered. Be careful on the path you provided.

Background

Why did I make this? I need this package for a specific usage in my Google Colab workflow.

Special Thanks

pastebin-as-file repo for the PyPI directory format. I'm a noob and just learned about Python package stuff tonight :D Also gdown for pyproject.toml and __main__.py reference.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pastebin_replace-0.1.1.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

pastebin_replace-0.1.1-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page