From 69b3680361d3e5f1c61c7d84c672c348f7220800 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Thu, 11 Feb 2016 03:00:58 -0800 Subject: [PATCH] Custom user agent Ref https://github.com/buckket/twtxt/issues/3#issuecomment-182738604 --- src/twtxt.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/twtxt.nim b/src/twtxt.nim index eea300b..7140c51 100644 --- a/src/twtxt.nim +++ b/src/twtxt.nim @@ -2,6 +2,7 @@ import db_sqlite, json, httpclient, os, strutils, times, time/gotime const ISOTime*: string = "yyyy-MM-dd'T'HH:mm:ss'.000000+'zzz" + version: string = staticExec "git describe --tags --long" type Tweet* = object of RootObj @@ -49,7 +50,7 @@ proc fromDBRow*(r: Row): Tweet = proc getTweetsFrom*(url: string, username: string): seq[Tweet] = var res = newSeq[Tweet]() - let body = url.getContent(timeout=20_000) + let body = url.getContent(timeout=20_000, userAgent = "https://twtxtlist.cf " & version & " (+https://xena.greedo.xeserv.us/files/xena.txt; @xena)") for line in body.splitLines().items(): if line.len > 0 and line[0] != '#':