Skip to content

Instantly share code, notes, and snippets.

@rodion-gudz
Created May 14, 2023 17:22
Show Gist options
  • Save rodion-gudz/fa8b77151bcf306146cbf993e941d747 to your computer and use it in GitHub Desktop.
Save rodion-gudz/fa8b77151bcf306146cbf993e941d747 to your computer and use it in GitHub Desktop.
Script for checking RDP.SH servers stock
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