mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
removed validators library and improved url validation
This commit is contained in:
@@ -4,8 +4,8 @@ import os
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
import validators
|
||||
|
||||
from cookbook.helper.HelperFunctions import validate_import_url
|
||||
from cookbook.models import Recipe, RecipeImport, SyncLog
|
||||
from cookbook.provider.provider import Provider
|
||||
|
||||
@@ -107,7 +107,7 @@ class Dropbox(Provider):
|
||||
recipe.save()
|
||||
|
||||
url = recipe.link.replace('www.dropbox.', 'dl.dropboxusercontent.')
|
||||
if validators.url(url, public=True):
|
||||
if validate_import_url(url):
|
||||
response = requests.get(url)
|
||||
|
||||
return io.BytesIO(response.content)
|
||||
|
||||
@@ -4,8 +4,9 @@ import tempfile
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
import validators
|
||||
import webdav3.client as wc
|
||||
|
||||
from cookbook.helper.HelperFunctions import validate_import_url
|
||||
from cookbook.models import Recipe, RecipeImport, SyncLog
|
||||
from cookbook.provider.provider import Provider
|
||||
from requests.auth import HTTPBasicAuth
|
||||
@@ -93,7 +94,7 @@ class Nextcloud(Provider):
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
if validators.url(url, public=True):
|
||||
if validate_import_url(url):
|
||||
r = requests.get(
|
||||
url,
|
||||
headers=headers,
|
||||
|
||||
Reference in New Issue
Block a user