Spaces:
Runtime error
Runtime error
Commit ·
e4a574e
1
Parent(s): db192d0
Update load_rock.py
Browse files- load_rock.py +3 -1
load_rock.py
CHANGED
|
@@ -2,6 +2,8 @@ from app_vars import *
|
|
| 2 |
from bs4 import BeautifulSoup as bs
|
| 3 |
import random as r
|
| 4 |
import requests
|
|
|
|
|
|
|
| 5 |
headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
| 6 |
"Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
| 7 |
"Accept-Encoding": "gzip, deflate, br",
|
|
@@ -59,4 +61,4 @@ def get_rock_name_url():
|
|
| 59 |
img = requests.get(url,headers = headers).content
|
| 60 |
print(img)
|
| 61 |
f.write(img)
|
| 62 |
-
return name,
|
|
|
|
| 2 |
from bs4 import BeautifulSoup as bs
|
| 3 |
import random as r
|
| 4 |
import requests
|
| 5 |
+
from PIL import Image
|
| 6 |
+
from io import BytesIO
|
| 7 |
headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
| 8 |
"Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
| 9 |
"Accept-Encoding": "gzip, deflate, br",
|
|
|
|
| 61 |
img = requests.get(url,headers = headers).content
|
| 62 |
print(img)
|
| 63 |
f.write(img)
|
| 64 |
+
return name, Image.open(BytesIO(img))
|