9 changed files with 83 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||||
|
# Default ignored files |
||||
|
/shelf/ |
||||
|
/workspace.xml |
@ -0,0 +1,6 @@ |
|||||
|
<component name="InspectionProjectProfileManager"> |
||||
|
<settings> |
||||
|
<option name="USE_PROJECT_PROFILE" value="false" /> |
||||
|
<version value="1.0" /> |
||||
|
</settings> |
||||
|
</component> |
@ -0,0 +1,7 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="Black"> |
||||
|
<option name="sdkName" value="Python 3.12 (ziskaniDat)" /> |
||||
|
</component> |
||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (ziskaniDat)" project-jdk-type="Python SDK" /> |
||||
|
</project> |
@ -0,0 +1,8 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="ProjectModuleManager"> |
||||
|
<modules> |
||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ziskaniDat.iml" filepath="$PROJECT_DIR$/.idea/ziskaniDat.iml" /> |
||||
|
</modules> |
||||
|
</component> |
||||
|
</project> |
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<module type="PYTHON_MODULE" version="4"> |
||||
|
<component name="NewModuleRootManager"> |
||||
|
<content url="file://$MODULE_DIR$"> |
||||
|
<excludeFolder url="file://$MODULE_DIR$/.venv" /> |
||||
|
</content> |
||||
|
<orderEntry type="inheritedJdk" /> |
||||
|
<orderEntry type="sourceFolder" forTests="false" /> |
||||
|
</component> |
||||
|
</module> |
After Width: | Height: | Size: 4.7 MiB |
@ -0,0 +1,13 @@ |
|||||
|
import requests |
||||
|
|
||||
|
url = "https://api.chucknorris.io/jokes/random" |
||||
|
|
||||
|
while(input("Next joke? q = exit") != "q"): |
||||
|
response = requests.get(url) |
||||
|
|
||||
|
if response.status_code == 200: |
||||
|
data = response.json() |
||||
|
print(f"Joke: {data["value"]}") |
||||
|
print(data["created_at"]) |
||||
|
else: |
||||
|
print(f"Chyba: {response.status_code}") |
@ -0,0 +1,14 @@ |
|||||
|
import requests |
||||
|
from PIL import Image |
||||
|
|
||||
|
response = requests.get("https://yesno.wtf/api") |
||||
|
|
||||
|
if response.status_code == 200: |
||||
|
data = response.json() |
||||
|
#print(data) |
||||
|
image_url = data["image"] |
||||
|
image_response = requests.get(image_url) |
||||
|
with open("image.gif","wb") as f: |
||||
|
f.write(image_response.content) |
||||
|
image = Image.open("image.gif") |
||||
|
image.show() |
@ -0,0 +1,22 @@ |
|||||
|
import requests |
||||
|
from PIL import Image |
||||
|
import matplotlib.pyplot as plt |
||||
|
import matplotlib.animation as animation |
||||
|
|
||||
|
response = requests.get("https://yesno.wtf/api") |
||||
|
|
||||
|
if response.status_code == 200: |
||||
|
data = response.json() |
||||
|
#print(data) |
||||
|
image_url = data["image"] |
||||
|
image_response = requests.get(image_url) |
||||
|
with open("image.gif","wb") as f: |
||||
|
f.write(image_response.content) |
||||
|
image = Image.open("image.gif") |
||||
|
num_frames = image.n_frames |
||||
|
def update_image(frame_num): |
||||
|
image.seek(frame_num) |
||||
|
plt.imshow(image) |
||||
|
anim = animation.FuncAnimation(plt.gcf(), update_image,interval=40,frames=num_frames) |
||||
|
|
||||
|
plt.show() |
Loading…
Reference in new issue