Skip to content

Instantly share code, notes, and snippets.

View Malith-Rukshan's full-sized avatar
πŸ‘¨β€πŸ’»
Single Developers </>

Malith Rukshan Malith-Rukshan

πŸ‘¨β€πŸ’»
Single Developers </>
View GitHub Profile
@Malith-Rukshan
Malith-Rukshan / validateInitData.py
Last active April 22, 2025 02:36
Validate Init data of Telegram Mini-App | TypeScript & Python
import hmac
def checkValidateInitData(hash_str, init_data, token, c_str="WebAppData"):
"""
Validates the data received from the Telegram web app, using the
method documented here:
https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app
hash_str - the has string passed by the webapp
init_data - the query string passed by the webapp
@Malith-Rukshan
Malith-Rukshan / example.py
Last active October 27, 2021 06:53
API BΡ‡ πŸ‘» πš‚πš’πš—πšπš•πšŽ π™³πšŽπšŸπšŽπš•πš˜πš™πšŽπš›πšœ ✌️
import requests
import json
servers=json.loads(requests.get('https://single-developers.herokuapp.com/servers').content)
for server in servers:
id=str(server)
ip=servers[str(server)]['ip']
location=servers[str(server)]['location']
emoji=servers[str(server)]['emoji']
print(