Registrations currently disabled due to spam. Contact me externally if you need an account
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Phen Cogs Fork
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
natalie
Phen Cogs Fork
Commits
5270c621
Commit
5270c621
authored
3 years ago
by
PhenoM4n4n
Browse files
Options
Downloads
Patches
Plain Diff
[typeracer] update quote api
parent
87905ccc
No related branches found
Branches containing commit
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
typeracer/typeracer.py
+8
-8
8 additions, 8 deletions
typeracer/typeracer.py
with
8 additions
and
8 deletions
typeracer/typeracer.py
+
8
−
8
View file @
5270c621
...
...
@@ -24,7 +24,7 @@ class TypeRacer(commands.Cog):
FONT_SIZE
=
30
__version__
=
"
1.0.
3
"
__version__
=
"
1.0.
4
"
def
__init__
(
self
,
bot
:
Red
)
->
None
:
self
.
bot
=
bot
...
...
@@ -48,13 +48,13 @@ class TypeRacer(commands.Cog):
pass
async
def
get_quote
(
self
)
->
Tuple
[
str
,
str
]:
#
async with self.session.get("https://api.quotable.io/random") as resp:
#
data = await resp.json()
#
return
resp
["content"],
resp
["author"]
#
old api went down, if it starts working again I'd like to switch back to it
async
with
self
.
session
.
get
(
"
https://zenquotes.io/api/random
"
)
as
resp
:
data
=
json
.
loads
(
await
resp
.
text
()
)[
0
]
return
data
[
"
q
"
],
data
[
"
a
"
]
async
with
self
.
session
.
get
(
"
https://api.quotable.io/random
"
)
as
resp
:
data
=
await
resp
.
json
()
return
data
[
"
content
"
],
data
[
"
author
"
]
#
back up api in case above goes down
#
async with self.session.get("https://zenquotes.io/api/random") as resp:
#
data =
await resp.json(content_type=None
)[0]
#
return data["q"], data["a"]
@property
def
font
(
self
)
->
ImageFont
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment