Bulk import URL with custom setting #2993
Unanswered
tsukiazuma
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Using the API is the way to go. In this example, I use the Curl-like client which is API doc: https://changedetection.io/docs/api_v1/index.html from urllib.parse import urlparse, urljoin
import requests
session = requests.session()
API_KEY = "xxxxxxxxxxxxxxxxxx"
API_HOST = "http://localhost:5000/"
session.headers.update({"x-api-key": API_KEY})
def add_watch(url, paused=False, proxy="HTTPS_PROXY", tag=None, title=None, extract_title_as_title=True, fetch_backend="html_requests"):
api_url = urljoin(API_HOST, "/api/v1/watch")
payload = {
"url": url,
"paused": paused,
"proxy": proxy,
"tag": tag,
"title": title,
"extract_title_as_title": extract_title_as_title,
"fetch_backend": fetch_backend
}
result = session.post(api_url, json=payload)
print(api_url, result.text)
return result.json() |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have many url need import and want to edit setting:
Beta Was this translation helpful? Give feedback.
All reactions