Download app/utils/base64_decoder.py from oyi77/1proxy: direct link, hf CLI and curl.
- Browser
- Download file 546 Bytes
-
https://huggingface.co/spaces/oyi77/1proxy/resolve/1998928f9152e05df87515ea77d6c4bbcc7e59b2/app/utils/base64_decoder.py
- Command line
-
hf download hf://spaces/oyi77/1proxy@1998928f9152e05df87515ea77d6c4bbcc7e59b2/app/utils/base64_decoder.py
-
curl -L -o base64_decoder.py https://huggingface.co/spaces/oyi77/1proxy/resolve/1998928f9152e05df87515ea77d6c4bbcc7e59b2/app/utils/base64_decoder.py
546 Bytes
| import base64 | |
| class SubscriptionDecoder: | |
| def decode(encoded_content: str) -> str: | |
| if not encoded_content: | |
| return "" | |
| try: | |
| missing_padding = len(encoded_content) % 4 | |
| if missing_padding: | |
| encoded_content += "=" * (4 - missing_padding) | |
| decoded_bytes = base64.b64decode(encoded_content) | |
| return decoded_bytes.decode("utf-8") | |
| except Exception as e: | |
| raise ValueError(f"Invalid base64 content: {e}") | |