Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
biondo
router-forecast-led
Commits
c6b72fc6
Commit
c6b72fc6
authored
Feb 20, 2017
by
Mattia Bondanza
Browse files
Prints time and weather for Pisa in the next three days.
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
pycurltest.py
0 → 100644
View file @
c6b72fc6
import
pycurl
import
json
from
StringIO
import
StringIO
buffer
=
StringIO
()
c
=
pycurl
.
Curl
()
c
.
setopt
(
c
.
URL
,
'api.openweathermap.org/data/2.5/forecast?q=pisa,it&APPID=c5ebd88f4494c472f3032e3426b6f0c6'
)
c
.
setopt
(
c
.
WRITEDATA
,
buffer
)
c
.
perform
()
c
.
close
()
body
=
buffer
.
getvalue
()
parsed
=
json
.
loads
(
body
)
for
i
in
parsed
[
"list"
]:
print
i
[
"dt_txt"
],
" "
,
i
[
"weather"
][
0
][
"description"
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment