Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/maven/lister.py
Show All 12 Lines | |||||
from bs4 import BeautifulSoup | from bs4 import BeautifulSoup | ||||
import lxml | import lxml | ||||
import requests | import requests | ||||
from swh.core.github.utils import GitHubSession | from swh.core.github.utils import GitHubSession | ||||
from swh.scheduler.interface import SchedulerInterface | from swh.scheduler.interface import SchedulerInterface | ||||
from swh.scheduler.model import ListedOrigin | from swh.scheduler.model import ListedOrigin | ||||
from .. import USER_AGENT | |||||
from ..pattern import CredentialsType, Lister | from ..pattern import CredentialsType, Lister | ||||
logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
RepoPage = Dict[str, Any] | RepoPage = Dict[str, Any] | ||||
SUPPORTED_SCM_TYPES = ("git", "svn", "hg", "cvs", "bzr") | SUPPORTED_SCM_TYPES = ("git", "svn", "hg", "cvs", "bzr") | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | ): | ||||
url=url, | url=url, | ||||
instance=instance, | instance=instance, | ||||
) | ) | ||||
self.session.headers.update({"Accept": "application/json"}) | self.session.headers.update({"Accept": "application/json"}) | ||||
self.jar_origins: Dict[str, ListedOrigin] = {} | self.jar_origins: Dict[str, ListedOrigin] = {} | ||||
self.github_session = GitHubSession( | self.github_session = GitHubSession( | ||||
credentials=self.credentials, user_agent=USER_AGENT | credentials=self.credentials, | ||||
user_agent=str(self.session.headers["User-Agent"]), | |||||
) | ) | ||||
def state_from_dict(self, d: Dict[str, Any]) -> MavenListerState: | def state_from_dict(self, d: Dict[str, Any]) -> MavenListerState: | ||||
return MavenListerState(**d) | return MavenListerState(**d) | ||||
def state_to_dict(self, state: MavenListerState) -> Dict[str, Any]: | def state_to_dict(self, state: MavenListerState) -> Dict[str, Any]: | ||||
return asdict(state) | return asdict(state) | ||||
▲ Show 20 Lines • Show All 300 Lines • Show Last 20 Lines |