# coding=utf-8
import requests
import json
class HttpConnect:
def __init__(self):
self.headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'
}
def request_get(self, url):
try:
res = requests.get(url=url, headers=self.headers)
if res.status_code == 200:
return json.loads(res.text, encoding='utf-8')
else:
return ''
except Exception as e:
print(e)
return ''