Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

和风天气返回GZIP无法解析 #2

Open
tignioj opened this issue Dec 3, 2022 · 1 comment
Open

和风天气返回GZIP无法解析 #2

tignioj opened this issue Dec 3, 2022 · 1 comment

Comments

@tignioj
Copy link

tignioj commented Dec 3, 2022

和风天气已经不支持直接返回字符串了,而是返回的gzip。我目前的解决办法只能用一个代理服务器来解压GZIP然后传送给ESP8266

    @GetMapping(value = "/**", produces = "application/json")
    @ResponseBody
    public String proxy(HttpServletRequest req) {
        try {
            System.out.println(req.getRequestURI());
            String url = "https://devapi.qweather.com" + req.getRequestURI() + "?" + req.getQueryString();
            String run = run(url);
            return String.format(run);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

打包成jar包,用手机的Termux运行作为代理服务器。
不知道ESP8266有没有办法解析GZIP。

@tignioj
Copy link
Author

tignioj commented Dec 7, 2022

已经找到解压方法,安装这个库 https://github.com/tignioj/ArduinoUZlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant