Created
May 14, 2023 17:22
-
-
Save rodion-gudz/fa8b77151bcf306146cbf993e941d747 to your computer and use it in GitHub Desktop.
Script for checking RDP.SH servers stock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
import requests | |
BASE_URL = "https://rdp.sh" | |
BOT_TOKEN = "1234567890:ABCDEF1234567890abcdef1234567890" | |
CHAT_ID = 123456789 | |
REGIONS = ["us", "us-2", "pl", "nl"] | |
REGIONS_NAMES = { | |
"us": "Phoenix", | |
"us-2": "Miami", | |
"pl": "Warsaw", | |
"nl": "Amsterdam", | |
} | |
REGIONS_EMOJI = { | |
"us": "🇺🇸", | |
"us-2": "🇺🇸", | |
"pl": "🇵🇱", | |
"nl": "🇳🇱", | |
} | |
while True: | |
for region in REGIONS: | |
r = requests.post( | |
f"{BASE_URL}/api/stock", | |
json={"plan": {"title": "Regular"}, "region": region}, | |
) | |
if r.json()["stocked"]: | |
requests.get( | |
f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage", | |
params={ | |
"chat_id": CHAT_ID, | |
"text": f"❗️ Доступен сервер Regular в регионе {REGIONS_EMOJI[region]} {REGIONS_NAMES[region]}\n\n" | |
}, | |
) | |
sleep(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment