return json from the db request
This commit is contained in:
parent
5662f0eca3
commit
deea320d98
1 changed files with 13 additions and 10 deletions
|
@ -41,16 +41,19 @@ async def epg(ctx):
|
||||||
if requests.get(db_url).status_code == 200:
|
if requests.get(db_url).status_code == 200:
|
||||||
response = requests.get(db_url)
|
response = requests.get(db_url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
content = response.text
|
content = response.json
|
||||||
await ctx.channel.send(type(content))
|
await ctx.channel.send('epg:')
|
||||||
|
|
||||||
|
if content != {}:
|
||||||
for item in content:
|
for item in content:
|
||||||
if item['start_at'] == 'now' or item['start_at'] == 'never':
|
if item['start_at'] == 'now' or item['start_at'] == 'never':
|
||||||
await ctx.channel.send('x')
|
await ctx.channel.send('x')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
await ctx.channel.send('y')
|
await ctx.channel.send('x')
|
||||||
await ctx.channel.send(item['start_at'])
|
await ctx.channel.send(item['start_at'])
|
||||||
|
else:
|
||||||
|
await ctx.channel.send('Empty database!')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue