lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.17-59-g5cdef0d

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.17-59-g5cdef0d



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  5cdef0d2b7df30441e128cd2b7510979efd12e0e (commit)
       via  580d6e0c568026e6b60acffd81163743ed1a7727 (commit)
      from  7348c7a40541ff59bff309fec512f7476fd8ca3b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=5cdef0d2b7df30441e128cd2b7510979efd12e0e

commit 5cdef0d2b7df30441e128cd2b7510979efd12e0e
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Nov 13 18:28:04 2022 +0100

    Increase timeout for CN Open Data download
    
    It seems that raw.githubusercontent.com can be extremely slow.

diff --git a/update/cn_loc.py b/update/cn_loc.py
index 5f35c3b..e8debf7 100755
--- a/update/cn_loc.py
+++ b/update/cn_loc.py
@@ -3,7 +3,7 @@
 # update/cn_loc.py - script to fetch data from the CN Open Data community
 #
 # Copyright (C) 2014-2015 Jiangge Zhang
-# Copyright (C) 2015-2019 Arthur de Jong
+# Copyright (C) 2015-2022 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -58,7 +58,7 @@ def fetch_data():
     """Return the data from tab-separated revisions as one code/name dict."""
     data_collection = OrderedDict()
     for revision in data_revisions:
-        response = requests.get('%s/raw/release/%s.txt' % (data_url, 
revision), timeout=30)
+        response = requests.get('%s/raw/release/%s.txt' % (data_url, 
revision), timeout=120)
         response.raise_for_status()
         if response.ok:
             print('%s is fetched' % revision, file=sys.stderr)

https://arthurdejong.org/git/python-stdnum/commit/?id=580d6e0c568026e6b60acffd81163743ed1a7727

commit 580d6e0c568026e6b60acffd81163743ed1a7727
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Nov 13 18:27:35 2022 +0100

    Pick up custom certificate from script path
    
    This ensures that the script can be run from any directory.
    
    Fixes c4ad714

diff --git a/update/my_bp.py b/update/my_bp.py
index 9da6eb9..d7ed69e 100755
--- a/update/my_bp.py
+++ b/update/my_bp.py
@@ -22,6 +22,7 @@
 """This script downloads the list of states and countries and their
 birthplace code from the National Registration Department of Malaysia."""
 
+import os
 import re
 from collections import defaultdict
 
@@ -61,19 +62,20 @@ def parse(content):
 
 
 if __name__ == '__main__':
+    ca_certificate = os.path.join(os.path.dirname(__file__), 'my_bp.crt')
     headers = {
         'User-Agent': user_agent,
     }
     results = defaultdict(lambda: defaultdict(set))
     # read the states
-    response = requests.get(state_list_url, headers=headers, 
verify='update/my_bp.crt', timeout=30)
+    response = requests.get(state_list_url, headers=headers, 
verify=ca_certificate, timeout=30)
     response.raise_for_status()
     for state, bps in parse(response.content):
         for bp in bps:
             results[bp]['state'] = state
             results[bp]['countries'].add('Malaysia')
     # read the countries
-    response = requests.get(country_list_url, headers=headers, 
verify='update/my_bp.crt', timeout=30)
+    response = requests.get(country_list_url, headers=headers, 
verify=ca_certificate, timeout=30)
     response.raise_for_status()
     for country, bps in parse(response.content):
         for bp in bps:

-----------------------------------------------------------------------

Summary of changes:
 update/cn_loc.py | 4 ++--
 update/my_bp.py  | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
python-stdnum