Bug#955268: udd watch: "429 too many requests" from GitHub
On Sun, Mar 29, 2020 at 04:39:01PM +0200, Lucas Nussbaum wrote:
> On 29/03/20 at 00:28 +0100, Adam Borowski wrote:
> > IIRC with an access token the limit is 5000 queries per hour. Without a
> > token, much, much less.
>
> The UDD code calls uscan. Is there a way for uscan to use an access
> token?
First, some longer-winded way:
One of snippets I use is:
TOKEN="kilobyte:cafebabe00000000deadbeef00000000baadf00d"
org=joeblows
p=hotbabe
for (( i=1; i<=$max; i++ )); do
if [ -e ./$i ];then T="-z ./$i";else T="";fi
curl -u "$TOKEN" $T -sS -o "$i" "https://api.github.com/repos/$org/$p/issues/$i"
done
You want timestamping -- as, if the file is already there, it doesn't count
against the limit. But not all parts of GitHub bear timestamps; for those,
"sleep 1" is nice as 3600/h < 5000/h.
Back to uscan:
The watch file includes only the URL, so there's no need to parse a command.
So the hack in uscan would be just:
if the URL is github.com and $ENV{GITHUB_TOKEN}, auth as that
Yeah, it would be site-specific code which is philosophically a wrong thing
to do, but meh.
Meow!
--
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ in the beginning was the boot and root floppies and they were good.
⢿⡄⠘⠷⠚⠋⠀ -- <willmore> on #linux-sunxi
⠈⠳⣄⠀⠀⠀⠀
Reply to: