当前位置: 首页 > news >正文

一个网站怎么推广宁波公司网站开发招聘

一个网站怎么推广,宁波公司网站开发招聘,网络投放广告平台,百度推广多少钱一天吐槽 最近在自研开发一款有关读取健康数据的APP 但是数据来源非常稀少#xff0c;申请了市面上所有的国内厂商的手环api都被拒了#xff08;因为是个人开发#xff09; 找了很久发现fitbit有开源的api于是淘了个fitbit的手表开始开发 Web API (fitbit.com) 在上述连接可…吐槽 最近在自研开发一款有关读取健康数据的APP 但是数据来源非常稀少申请了市面上所有的国内厂商的手环api都被拒了因为是个人开发 找了很久发现fitbit有开源的api于是淘了个fitbit的手表开始开发 Web API (fitbit.com) 在上述连接可以按步骤使用api 不知道是不是因为我英语不好的原因总是感觉开发文档写的很拉想找找大佬的实例代码跑一下发现要么找不到要么直接没法用。 没办法只能手搓。。。 以下是项目结构 pom dependenciesdependencygroupIdcom.anXin/groupIdartifactIdanXin-utils/artifactIdversion3.6.3/version/dependencydependencygroupIdjunit/groupIdartifactIdjunit/artifactIdscopetest/scope/dependencydependencygroupIdorg.apache.httpcomponents/groupIdartifactIdhttpclient/artifactIdversion4.5.13/version/dependencydependencygroupIdcom.google.code.gson/groupIdartifactIdgson/artifactId/dependency/dependencies utils是我自己的工具类其实只用到了base64加密随便搜一个替换就行 思路 首先注册一个应用程序这个很简单不教学了主要是获取token等关键信息因为这些api都基于这些关键信息 他的授权码请求URL https://www.fitbit.com/oauth2/authorize?client_idABC123response_typecode code_challengecode_challengecode_challenge_methodS256 scopeactivity%20heartrate%20location%20nutrition%20oxygen_saturation%20profile %20respiratory_rate%20settings%20sleep%20social%20temperature%20weight 但是会跳出以下授权页面 抓包发现是全部授权后会重定向因此直接模拟浏览器重定向请求在下面的代码已经给出 即可获取授权码来获取token 要注意的是请求一定要携带cookie不然会自动重定向到登录 实现 service定义接口 实现类先预留以下属性 private String clientId你的客户端id;private String clientSecret你的客户端秘钥;private String scopeactivity heartrate location nutrition profile settings sleep social weight;private String userAuthorizationUrihttps://www.fitbit.com/oauth2/authorize;private String accessTokenUrihttps://api.fitbit.com/oauth2/token;private String code;private String access_token;private String refresh_token;private String token_type;private String user_id; 接下来实现接口 try {// 创建CookieStore并设置CookieCookieStore cookieStore new BasicCookieStore();BasicClientCookie cookie new BasicClientCookie(Cookie, 自己在请求头那里复制); // 替换为实际的Cookie信息cookie.setDomain(www.fitbit.com); // 设置Cookie的作用域cookie.setPath(/); // 设置Cookie的路径cookieStore.addCookie(cookie);CloseableHttpClient httpClient HttpClients.custom().setDefaultCookieStore(cookieStore).build();String postData client_idclientIdresponse_typecodescopeactivityheartratelocationnutritionoxygen_saturationprofilerespiratory_ratesettingssleepsocialtemperatureweightstatepromptnone;HttpPost httpPost new HttpPost(userAuthorizationUri);// 设置POST请求的Content-TypehttpPost.setHeader(Content-Type, application/x-www-form-urlencoded);// 设置POST请求的参数StringEntity entity new StringEntity(postData, StandardCharsets.UTF_8);httpPost.setEntity(entity);CloseableHttpResponse response httpClient.execute(httpPost);int statusCode response.getStatusLine().getStatusCode();if (statusCode302){Header locationHeader response.getFirstHeader(Location);if (locationHeader ! null) {String redirectURL locationHeader.getValue();System.out.println(以下为fitbit服务信息);System.out.println(重定向的路径 redirectURL);coderedirectURL.substring(redirectURL.indexOf()1).split(#)[0];System.out.println(Authorize为code);} else {System.out.println(未找到重定向路径);}}else {log.error(fitbit获取code失败);}CloseableHttpClient tokenHttpClient HttpClients.createDefault();String tokenPostData grant_typeauthorization_codecodecode;HttpPost tokenHttpPost new HttpPost(accessTokenUri);// 设置POST请求的Content-TypetokenHttpPost.setHeader(Authorization,Basic Base64Utils.encode((clientId:clientSecret).getBytes()));tokenHttpPost.setHeader(Content-Type, application/x-www-form-urlencoded);// 设置POST请求的参数StringEntity tokenEntity new StringEntity(tokenPostData, StandardCharsets.UTF_8);tokenHttpPost.setEntity(tokenEntity);CloseableHttpResponse tokenResponse tokenHttpClient.execute(tokenHttpPost);BufferedReader reader new BufferedReader(new InputStreamReader(tokenResponse.getEntity().getContent()));StringBuilder jsonResponse new StringBuilder();String line;while ((line reader.readLine()) ! null) {jsonResponse.append(line);}System.out.println(返回的JSON数据 jsonResponse.toString());Gson gson new Gson();MapString,Object map gson.fromJson(jsonResponse.toString(), Map.class);access_token (String) map.get(access_token);refresh_token (String) map.get(refresh_token);token_type (String) map.get(token_type);user_id (String) map.get(user_id);System.out.println(access_token为access_token);System.out.println(refresh_token为refresh_token);System.out.println(token_type为token_type);System.out.println(user_id为user_id);System.out.println(fitbit服务信息结束);}catch (Exception e){log.error(获取fitbit的token失败);e.printStackTrace();} 手搓成功
文章转载自:
http://www.morning.wxccm.cn.gov.cn.wxccm.cn
http://www.morning.lthgy.cn.gov.cn.lthgy.cn
http://www.morning.fjshyc.com.gov.cn.fjshyc.com
http://www.morning.cwfkm.cn.gov.cn.cwfkm.cn
http://www.morning.hxpsp.cn.gov.cn.hxpsp.cn
http://www.morning.hdrsr.cn.gov.cn.hdrsr.cn
http://www.morning.lfxcj.cn.gov.cn.lfxcj.cn
http://www.morning.qqfcf.cn.gov.cn.qqfcf.cn
http://www.morning.rlrxh.cn.gov.cn.rlrxh.cn
http://www.morning.nwqyq.cn.gov.cn.nwqyq.cn
http://www.morning.wmyqw.com.gov.cn.wmyqw.com
http://www.morning.glnfn.cn.gov.cn.glnfn.cn
http://www.morning.fnpmf.cn.gov.cn.fnpmf.cn
http://www.morning.gsjzs.cn.gov.cn.gsjzs.cn
http://www.morning.dzdtj.cn.gov.cn.dzdtj.cn
http://www.morning.jjmrx.cn.gov.cn.jjmrx.cn
http://www.morning.sjftk.cn.gov.cn.sjftk.cn
http://www.morning.sxwfx.cn.gov.cn.sxwfx.cn
http://www.morning.fbnsx.cn.gov.cn.fbnsx.cn
http://www.morning.taipinghl.cn.gov.cn.taipinghl.cn
http://www.morning.lqchz.cn.gov.cn.lqchz.cn
http://www.morning.dbfp.cn.gov.cn.dbfp.cn
http://www.morning.kwqcy.cn.gov.cn.kwqcy.cn
http://www.morning.ydhmt.cn.gov.cn.ydhmt.cn
http://www.morning.lgnz.cn.gov.cn.lgnz.cn
http://www.morning.hhpkb.cn.gov.cn.hhpkb.cn
http://www.morning.rdkt.cn.gov.cn.rdkt.cn
http://www.morning.wwdlg.cn.gov.cn.wwdlg.cn
http://www.morning.fengnue.com.gov.cn.fengnue.com
http://www.morning.pfcrq.cn.gov.cn.pfcrq.cn
http://www.morning.jfbbq.cn.gov.cn.jfbbq.cn
http://www.morning.mnlk.cn.gov.cn.mnlk.cn
http://www.morning.wmyqw.com.gov.cn.wmyqw.com
http://www.morning.iuibhkd.cn.gov.cn.iuibhkd.cn
http://www.morning.jstggt.cn.gov.cn.jstggt.cn
http://www.morning.rxfbf.cn.gov.cn.rxfbf.cn
http://www.morning.sfdsn.cn.gov.cn.sfdsn.cn
http://www.morning.rlxg.cn.gov.cn.rlxg.cn
http://www.morning.wfwqr.cn.gov.cn.wfwqr.cn
http://www.morning.kjgrg.cn.gov.cn.kjgrg.cn
http://www.morning.mszwg.cn.gov.cn.mszwg.cn
http://www.morning.rdlong.com.gov.cn.rdlong.com
http://www.morning.ykmtz.cn.gov.cn.ykmtz.cn
http://www.morning.zgztn.cn.gov.cn.zgztn.cn
http://www.morning.chmkt.cn.gov.cn.chmkt.cn
http://www.morning.rmjxp.cn.gov.cn.rmjxp.cn
http://www.morning.wmrgp.cn.gov.cn.wmrgp.cn
http://www.morning.vtbtje.cn.gov.cn.vtbtje.cn
http://www.morning.rbktw.cn.gov.cn.rbktw.cn
http://www.morning.rxfgh.cn.gov.cn.rxfgh.cn
http://www.morning.bpp999.com.gov.cn.bpp999.com
http://www.morning.lfbzg.cn.gov.cn.lfbzg.cn
http://www.morning.iknty.cn.gov.cn.iknty.cn
http://www.morning.bscsp.cn.gov.cn.bscsp.cn
http://www.morning.drytb.cn.gov.cn.drytb.cn
http://www.morning.fmgwx.cn.gov.cn.fmgwx.cn
http://www.morning.fxzlg.cn.gov.cn.fxzlg.cn
http://www.morning.jjhrj.cn.gov.cn.jjhrj.cn
http://www.morning.lndongguan.com.gov.cn.lndongguan.com
http://www.morning.nzmqn.cn.gov.cn.nzmqn.cn
http://www.morning.qhkdt.cn.gov.cn.qhkdt.cn
http://www.morning.jfbrt.cn.gov.cn.jfbrt.cn
http://www.morning.prgnp.cn.gov.cn.prgnp.cn
http://www.morning.llfwg.cn.gov.cn.llfwg.cn
http://www.morning.rbyz.cn.gov.cn.rbyz.cn
http://www.morning.cpgdy.cn.gov.cn.cpgdy.cn
http://www.morning.tbjb.cn.gov.cn.tbjb.cn
http://www.morning.rdmn.cn.gov.cn.rdmn.cn
http://www.morning.ttdxn.cn.gov.cn.ttdxn.cn
http://www.morning.xgbq.cn.gov.cn.xgbq.cn
http://www.morning.tfwg.cn.gov.cn.tfwg.cn
http://www.morning.qmwzz.cn.gov.cn.qmwzz.cn
http://www.morning.nhpgm.cn.gov.cn.nhpgm.cn
http://www.morning.glbnc.cn.gov.cn.glbnc.cn
http://www.morning.tmzlt.cn.gov.cn.tmzlt.cn
http://www.morning.mxxsq.cn.gov.cn.mxxsq.cn
http://www.morning.tcxzn.cn.gov.cn.tcxzn.cn
http://www.morning.wdpt.cn.gov.cn.wdpt.cn
http://www.morning.xtkw.cn.gov.cn.xtkw.cn
http://www.morning.kpbgp.cn.gov.cn.kpbgp.cn
http://www.tj-hxxt.cn/news/241958.html

相关文章:

  • 百度整站优化百度推广手机登录
  • 检察机关门户网站建设工作自查报告wordpress 编辑权限
  • 北京建站模板展示网站建设内容保障工作个人总结
  • 男男做视频网站龙岩网站制作设计
  • 网站的域名技巧和空间选择电商网站设计论文
  • 全球前10网站开发语言工作组赴河南协助
  • 服装加工厂网站建设方案计划书沈阳网页设计公司有哪些
  • 成都网站建设餐饮wordpress 文章自定义排序
  • 网站型和商城型有什么区别室内装修设计书籍
  • 美业网站网站建设公司专业
  • 访问网站详细过程新网站需要加锚文本吗
  • 哪家网站建设好门户网站建设管理工作自查报告
  • 容桂做网站做数据网站
  • 南昌的网站建设公司网络建设设计方案
  • c做网站教程达州网站建设yufanse
  • 网站维护和建设工作范围门户cms系统
  • wap的网站开发项目外包
  • 网站推广怎么做比较好企业宣传手册封面模板
  • o2o网站建设行业现状个人做外贸网站违法吗
  • wordpress数据量大网站访问海南百度首页广告
  • 宜兴市网站建设wordpress 预览demo
  • 做网站总费用百度seo排名优化排行
  • 建个人网站赚钱吗建筑网建设通网站作用是什么意思
  • 网站栏目wordpress自动还原
  • 外贸网站如何建设电商网站开发公司哪家好
  • 购物网站开发的意义河南外贸网站建设
  • asp 制作网站开发重庆建站网站免费
  • 高级网站开发培训中国电信全渠道运营中心
  • 网站建设案例 星座广告平面设计图片
  • 怎么用新浪云做网站ps网上教程