mrmp/remote.py

26 lines
549 B
Python
Raw Normal View History

2021-10-09 12:02:10 +00:00
import os
import requests
import arguments
import hypertext
2021-10-10 12:48:12 +00:00
import repository
2021-10-09 12:02:10 +00:00
2021-10-10 19:34:35 +00:00
MAIN = 'https://repo.msys2.org'
2021-10-09 12:02:10 +00:00
2021-10-10 12:48:12 +00:00
class Remote(repository.Repository):
2021-10-10 17:02:34 +00:00
def __init__(self):
super().__init__(arguments.remote)
2021-10-09 12:02:10 +00:00
2021-10-10 19:30:40 +00:00
def get_file(self, path):
return requests.get(os.path.join(self.location, path)).content
2021-10-09 12:02:10 +00:00
2021-10-10 18:27:48 +00:00
def get_files(self, path):
return hypertext.HyperText(os.path.join(self.location, path)).links
2021-10-09 12:02:10 +00:00
def __str__(self):
2021-10-10 13:01:24 +00:00
lines = [
super().__str__(),
]
2021-10-09 12:55:05 +00:00
return os.linesep.join(lines)