Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Last active September 5, 2023 11:36
Show Gist options
  • Save fmasanori/4745061 to your computer and use it in GitHub Desktop.
Save fmasanori/4745061 to your computer and use it in GitHub Desktop.
Chuck Norris Nerd Jokes
from urllib.request import Request, urlopen
import json
req = Request(
url='https://api.chucknorris.io/jokes/random',
headers={'User-Agent': 'Mozilla/5.0'}
)
resp = urlopen(req).read()
data = json.loads(resp.decode('utf-8'))
print (data['value'])
@fredsilva
Copy link

muito bom! Python é além de tudo divertido.
Ainda não sei o que vou fazer no meu TCC, a única coisa que eu sei é que vai ser em Python!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment