srlp/mrmp/remote.py

26 lines
549 B
Python
Raw Normal View History

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