This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
The following commit(s) were added to refs/heads/trunk by this push:
new 6008a84 Use utf-8 encoding to decode byte string, print sample
response to make debugging easier.
6008a84 is described below
commit 6008a84ef88ac490b8f70e1798a593496e8149df
Author: Tomaz Muraus <[email protected]>
AuthorDate: Sat Oct 23 12:09:19 2021 +0200
Use utf-8 encoding to decode byte string, print sample response to make
debugging easier.
---
contrib/scrape-ec2-prices.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/contrib/scrape-ec2-prices.py b/contrib/scrape-ec2-prices.py
index 554f745..06f935d 100755
--- a/contrib/scrape-ec2-prices.py
+++ b/contrib/scrape-ec2-prices.py
@@ -172,8 +172,10 @@ def scrape_ec2_pricing():
if re.match(r'.*?\.json$', url):
data = response.json()
+ print("Sample response: %s..." % (str(data)[:100]))
elif re.match(r'.*?\.js$', url):
- data = response.content.decode()
+ data = response.content.decode('utf-8')
+ print("Sample response: %s..." % (data[:100]))
match = re.match(r'^.*callback\((.*?)\);?$', data,
re.MULTILINE | re.DOTALL)
data = match.group(1)