zoukankan      html  css  js  c++  java
  • 个人实用api

    单机勿压

    1、 查地理位置的经纬度(geocoder)

      tips: 高德地图api 只能查国内的地址。google 地图使用一段时间会收费。本接口的原理:https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/utils/geocoder?hl=zh_CN#q%3D%25u4EAC   【需要FQ,google 地图】(技术的都懂哈)

      POST: http://128.14.132.26:9527/api/geocoder?address=北京市   (例如北京)

      结果返回: 

    {
        "results": [
            {
                "address_components": [
                    {
                        "long_name": "Beijing",
                        "short_name": "Beijing",
                        "types": [
                            "locality",
                            "political"
                        ]
                    },
                    {
                        "long_name": "Beijing",
                        "short_name": "Beijing",
                        "types": [
                            "administrative_area_level_1",
                            "political"
                        ]
                    },
                    {
                        "long_name": "China",
                        "short_name": "CN",
                        "types": [
                            "country",
                            "political"
                        ]
                    }
                ],
                "formatted_address": "Beijing, China",
                "geometry": {
                    "bounds": {
                        "northeast": {
                            "lat": 41.060816,
                            "lng": 117.514625
                        },
                        "southwest": {
                            "lat": 39.442758,
                            "lng": 115.423411
                        }
                    },
                    "location": {
                        "lat": 39.9042,
                        "lng": 116.407396
                    },
                    "location_type": "APPROXIMATE",
                    "viewport": {
                        "northeast": {
                            "lat": 40.216496,
                            "lng": 116.782984
                        },
                        "southwest": {
                            "lat": 39.661271,
                            "lng": 116.011934
                        }
                    }
                },
                "place_id": "ChIJuSwU55ZS8DURiqkPryBWYrk",
                "types": [
                    "locality",
                    "political"
                ]
            }
        ],
        "status": "ok"
    }
    

    2、google 翻译api

      tips: api 的原理见:https://translate.google.cn/?sl=auto&tl=en&op=translate  .这里使用模拟的方式进行翻译。这里主要支持了数组的翻译。整篇文章的翻译,自觉绕道去官网上复制粘贴吧。

      POST:  requests.post("http://128.14.132.26:9527/api/translate",json={"source_lang":"auto","target_lang":"en","need_trans":[]})       。要求每个元素不超过5k 个 unicode 字符。

      source_lang 参数见:官网sl 参数。target_lang参数见:官网tl 参数。need_trans里面需要传输一个List[str]。

      技术要点:官网中的输入框不能一个字符一个字符的敲击,这样会把浏览器搞死的【估计是监听了input 事件,每敲击一次都会进行翻译的】。大批量的翻译,只能使用复制粘贴的方式。

      比如实现方式如下:

      

      结果返回:

    {
        'data': ['China Airlines three times', 'PR three 01', 'PR three 02', 'China Airlines 3 03', 'Dragon control 02 excellent', 'Dragon control 02 times', '18 Guijin MTN001', 'Contemporary 03 excellent', '08 Shaanxi Defense', '19 votes 01', '10 Shaanxi Defense', '12 gold', '12 green rain 01', '12 Shen Wanfubble', '13 heteral titanium 01', '13 Jinhui 01', '13 Baishi debt', '13 can build MTN1 in 13', '13-day debt', '13 Jinhai 01'],
        'message': 'ok',
        'type': 'info'
    }

    持续更新中。。。

  • 相关阅读:
    为什么一段时间后网站后台自动退出 php中session过期时间设置
    php中的$_GET如何获取带有“#”的参数
    让页面在打开时自动刷新
    MySQL关联left join 条件on与where不同
    图形上下文的栈操作(保存和恢复)
    图形上下文的矩阵操作(平移-缩放-旋转)
    Quartz2D内存管理
    文字绘制-图片绘制-水印绘制思路
    UIBezierPath-完善曲线
    UIBezierPath-绘制基本图形
  • 原文地址:https://www.cnblogs.com/xunhanliu/p/14378392.html
Copyright © 2011-2022 走看看