From 07496221668f488164282db8d316692f8737a03e Mon Sep 17 00:00:00 2001 From: Tomas Rivera Date: Wed, 3 Jun 2026 14:10:27 +0200 Subject: [PATCH] fix: pycurl error --- nixpkgs_notifier.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/nixpkgs_notifier.py b/nixpkgs_notifier.py index f69bff0..6f4a6fc 100644 --- a/nixpkgs_notifier.py +++ b/nixpkgs_notifier.py @@ -37,13 +37,20 @@ DEFAULT_CONFIG = { "userPingServer": "matrix.org" } } + def getPRTitle(PRnumber): buf = io.BytesIO() - with pycurl.Curl() as c: - c.setopt(c.URL, "https://api.github.com/repos/NixOS/nixpkgs/pulls/" + str(PRnumber)) - c.setopt(c.USERAGENT, "pycurl") - c.setopt(c.WRITEDATA, buf) - c.perform() + + c = pycurl.Curl() + c.setopt( + c.URL, + f"https://api.github.com/repos/NixOS/nixpkgs/pulls/{PRnumber}" + ) + c.setopt(c.USERAGENT, "pycurl") + c.setopt(c.WRITEDATA, buf) + c.perform() + c.close() + return json.loads(buf.getvalue())["title"] def load_config():