FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-guild/code-guild/python/api-examples/sunlight.py at master · grantholly/code-guild · GitHub
grantholly
code-guild
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
code-guild
/
code-guild
/
python
/
api-examples
/
sunlight.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (19 loc) · 654 Bytes
Breadcrumbs
code-guild
/
code-guild
/
python
/
api-examples
/
sunlight.py
Copy path
File metadata and controls
24 lines (19 loc) · 654 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
__author__
=
'grant'
import
requests
import
pprint
userPhrase
=
input
(
'What phrase are you looking for?'
)
query_params
=
{
'apikey'
:
'0bfca639c9214f219d244705c7f1f90b'
,
'per_page'
:
3
,
'phrase'
:
userPhrase
,
'sort'
:
'date desc'
}
endpoint
=
'http://capitolwords.org/api/text.json'
response
=
requests
.
get
(
endpoint
,
params
=
query_params
)
data
=
response
.
json
#pprint.pprint(data)
legislator
=
data
[
'results'
][
0
][
'speaker_first'
]
+
' '
+
data
[
'results'
][
0
][
'speaker_last'
]
date
=
data
[
'results'
][
0
][
'date'
]
speech
=
data
[
'results'
][
0
][
'speaking'
]
print
(
"On "
+
date
+
', '
+
legislator
+
' '
+
"said:"
)
print
(
"
\'
"
)
print
(
speech
)
Back
|
FazBrowse Home
|
New Git URL