You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a new variable (container_name) to nitter.py file:
host: IPv4Address
port: int
container_name: str
I added this function to my nitter.py file:
def get(self):
client = self._get_client()
self.container = client.containers.get(
container_id=self.container_name
)
logger.info(f"Got container {self.container.name} {self.container.short_id}. Status {self.container.status} at {self.address}.")
And the context manager looks like this:
@contextmanager
def NitterScraper(host: str = "0.0.0.0", port: int = 8008, container_name: str = "ff1fc8e9f922"):
"""The NitterScraper context manager.
Takes care of configuring, starting, and stopping a docker instance of nitter.
Args:
host: The host address the docker container will bind too.
port: The port the docker container will listen to.
container_name: The name or id of the container to connect.
Yields:
Nitter: An object representing a started nitter docker container.
"""
nitter = Nitter(host=host, port=port, container_name=container_name)
nitter.get()
yield nitter
Would it be possible to use this connecting to an already running Nitter instance?
The text was updated successfully, but these errors were encountered: