Bez popisu

APIgrab.py 538B

1234567891011121314151617181920212223242526
  1. #stuff necessary for testing
  2. from PIL import Image
  3. import requests
  4. from io import BytesIO
  5. import pandas as pd
  6. import numpy as np
  7. import matplotlib.pyplot as plt
  8. import json
  9. #test values to test graph making
  10. array = np.array([[3,3,3],[4,4,4]])
  11. #save image to variable test
  12. url = "https://www.volks.co.jp/blog_nest/kobe/2020/1209_01.jpg"
  13. response = requests.get(url)
  14. img = Image.open(BytesIO(response.content))
  15. img.save("test.png")
  16. #pass values to json
  17. data = array
  18. with open("transfer.json", "w") as file:
  19. json.dump(data, file)