-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
48 lines (31 loc) · 1020 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: snipermonke01
"""
import requests
import os
class TelegramManager:
def __init__(self):
try:
self.bot_chatID = os.environ['MVX_TELEGRAM_CHAT_ID']
self.telegram_bot_api = os.environ['MVX_TELEGRAM_BOT_API']
except KeyError:
pass
def telegram_bot_sendtext(self, message):
send_url = 'https://api.telegram.org/bot{}/sendMessage?chat_id={}&parse_mode=Markdown&text={}'.format(
self.telegram_bot_api, self.bot_chatID, message)
response = requests.get(send_url)
return response.json()
def make_query(query: str):
"""
Post formatted query to mvx stats subgraph
Parameters
----------
query: str
Formatted subgraph query
"""
url = "https://api.thegraph.com/subgraphs/name/sdcrypt0/mvx-subgraph-core-v2"
result = requests.post(url,
json={'query': query}).json()
return result