This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new e99c8b4 Add stats options quick and emailsOnly
e99c8b4 is described below
commit e99c8b45f71a13d597bbfcb1e5a8366e14f0cbb7
Author: Sebb <[email protected]>
AuthorDate: Fri Nov 5 23:55:54 2021 +0000
Add stats options quick and emailsOnly
---
tools/ponyapi.rb | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/ponyapi.rb b/tools/ponyapi.rb
index 14aa034..e134d3d 100755
--- a/tools/ponyapi.rb
+++ b/tools/ponyapi.rb
@@ -91,10 +91,13 @@ module PonyAPI
# Download one month of stats as a JSON
# Must supply cookie = 'ponymail-logged-in-cookie' if a private list
- def get_pony_stats(dir, list, subdomain, year, month, cookie=nil,
sort_list=false)
+ def get_pony_stats(dir, list, subdomain, year, month, cookie=nil,
sort_list=false, opts={})
cookie = get_cookie() if cookie == 'prompt'
args = make_args(list, subdomain, year, month)
- uri, _request, response = fetch_pony(PONYSTATS % args, cookie)
+ url = PONYSTATS % args
+ url += '&quick' if opts[:quick]
+ url += '&emailsOnly' if opts[:emailsOnly]
+ uri, _request, response = fetch_pony(url, cookie)
if response.code == '200' then
return JSON.parse(response.body), args if dir.nil?
openfile(dir, STATSMBOX % args) do |f|
@@ -245,6 +248,8 @@ if __FILE__ == $0
true
when 'false'
false
+ when %r{\A{[":1a-zA-Z,]+}\z} # e.g. '{"quick":1,"emailsOnly":1}'
+ JSON.parse(arg, symbolize_names: true)
else
arg
end