import requests
UserAgent="Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0"
class Pump:
def PostThread(self, forum_id: int, thread_title: str, post_body: str):
data = {'forum_id': forum_id,'thread_title': thread_title,'post_body': post_body}
return self.session.post(self.baseUrl + f"threads", data)
def __init__(self, token='0', baseUrl="https://lozerix.com/api/"):
self.token = token
self.session = requests.session()
self.baseUrl = baseUrl
ua = str(UserAgent)
self.session.headers = {
'XF-Api-Key': self.token,
'content-type': 'application/x-www-form-urlencoded',
'cookie': '0',
'sec-ch-ua-platform': "Windows", 'Upgrade-Insecure-Requests': '1',
'User-Agent': ua
}
r= self.session.post('https://lozerix.com/api/me/', self.session.headers)
print(r.text)
p = Pump().__init__(token= '0', baseUrl="https://lozerix.com/api/")