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:
|
||||
response = requests.get(db_url)
|
||||
response.raise_for_status()
|
||||
content = response.text
|
||||
await ctx.channel.send(type(content))
|
||||
content = response.json
|
||||
await ctx.channel.send('epg:')
|
||||
|
||||
for item in content:
|
||||
if item['start_at'] == 'now' or item['start_at'] == 'never':
|
||||
await ctx.channel.send('x')
|
||||
continue
|
||||
else:
|
||||
await ctx.channel.send('y')
|
||||
await ctx.channel.send(item['start_at'])
|
||||
if content != {}:
|
||||
for item in content:
|
||||
if item['start_at'] == 'now' or item['start_at'] == 'never':
|
||||
await ctx.channel.send('x')
|
||||
continue
|
||||
else:
|
||||
await ctx.channel.send('x')
|
||||
await ctx.channel.send(item['start_at'])
|
||||
else:
|
||||
await ctx.channel.send('Empty database!')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
|
Loading…
Reference in a new issue