add guards for directly-executed modules (#37)

Co-authored-by: eli fessler <eliwf8@gmail.com>
This commit is contained in:
Sou Niyari
2022-10-23 14:26:34 +09:00
committed by GitHub
parent f5b9e2e63e
commit 26ca08b4f5
2 changed files with 14 additions and 3 deletions

View File

@@ -2,8 +2,8 @@
# https://github.com/frozenpandaman/s3s
# License: GPLv3
import requests, json, re, sys
import os, base64, hashlib
import base64, hashlib, json, os, re, sys
import requests
from bs4 import BeautifulSoup
session = requests.Session()
@@ -379,3 +379,8 @@ def enter_tokens():
new_bullettoken = input("Invalid token - length should be 124 characters. Try again.\nEnter your bulletToken: ")
return new_gtoken, new_bullettoken
if __name__ == "__main__":
print("This program cannot be run alone. See https://github.com/frozenpandaman/s3s")
sys.exit(0)

View File

@@ -2,7 +2,8 @@
# https://github.com/frozenpandaman/s3s
# License: GPLv3
import base64, datetime, json, re, requests, uuid
import base64, datetime, json, re, sys, uuid
import requests
from bs4 import BeautifulSoup
SPLATNET3_URL = "https://api.lp1.av5ja.srv.nintendo.net"
@@ -103,3 +104,8 @@ def custom_key_exists(key, config_data, value=True):
if key not in ["ignore_private", "app_user_agent", "force_uploads"]:
print("(!) Checking unexpected custom key")
return True if key in config_data and config_data[key].lower() == str(value).lower() else False
if __name__ == "__main__":
print("This program cannot be run alone. See https://github.com/frozenpandaman/s3s")
sys.exit(0)