Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions getdeck/fetch/deck_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

import logging
import tempfile

import requests
from git import Repo, GitError

from getdeck.fetch.types import DeckfileAux, TemporaryData

Expand All @@ -25,6 +23,12 @@ def fetch(self, data: DeckfileAux) -> DeckfileAux:

class Git(DeckFetchBehavior):
def fetch(self, data: DeckfileAux) -> DeckfileAux:
try:
from git import Repo, GitError
except Exception as e:
logger.debug(e)
raise FetchError("Git import error.")

location = data.location

if "#" in location:
Expand Down
7 changes: 6 additions & 1 deletion getdeck/fetch/source_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import tempfile

import requests
from git import Repo, GitError
from getdeck.fetch.types import SourceAux, TemporaryData


Expand All @@ -25,6 +24,12 @@ def fetch(self, data: SourceAux) -> SourceAux:

class Git(SourceFetchBehavior):
def fetch(self, data: SourceAux, *args, **kwargs) -> SourceAux:
try:
from git import Repo, GitError
except Exception as e:
logger.debug(e)
raise FetchError("Git import error.")

location = data.location

if "#" in location:
Expand Down