Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Check if url is an HTTP URL #12

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/vec2pg/common.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
from urllib.parse import urlparse

POSTGRES_CONNECTION_STRING = "POSTGRES_CONNECTION_STRING"


def is_http_url(url: str) -> bool:
return urlparse(url).scheme in {"https", "http"}
5 changes: 4 additions & 1 deletion src/vec2pg/plugins/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from qdrant_client import QdrantClient
from tqdm import tqdm

from vec2pg.common import POSTGRES_CONNECTION_STRING
from vec2pg.common import POSTGRES_CONNECTION_STRING, is_http_url

app = typer.Typer()

Expand Down Expand Up @@ -36,6 +36,9 @@ def migrate(
],
):

if not is_http_url(qdrant_url):
ValueError("qdrant_url must be a valid HTTP URL string")

# Init Pinecone client and index
client = QdrantClient(url=qdrant_url, api_key=qdrant_api_key)

Expand Down