使用googlemaps时区python客户端

时间:2019-03-08 15:29:13

标签: python

我正在尝试从此位置GoogleMaps Python client的googlemaps时区python客户端获取时区。

但是我无法使其工作,也没有任何示例。我尝试如下,但无法获得任何输出,将不胜感激

from googlemaps import timezone
print(timezone.timezone("APIKEY",[20,114]))

1 个答案:

答案 0 :(得分:1)

这个问题很旧,但是对于以后遇到这个问题的人,我几乎打开了一个类似的问题,但我自己想出了。这是我所做的:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;

namespace SO_59567958
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var ids = new[] { "1023086709", "1659325215", "1912946427", "1740219450", "1750497640", "1538260823", "1275625626", "1144303488", "1205919107", "1730281890", "1568453561" };
            Console.WriteLine($"Retrieving {ids.Length} NPI records...");

            var npiResults = new List<Result>();
            foreach (var id in ids)
            {
                var retrievedFromApi = await GetNpiEntry(id);
                npiResults.Add(retrievedFromApi);
            }

            Console.WriteLine("Done");
            npiResults.ForEach(x => Console.WriteLine(x.Number));
        }

        static async Task<Result> GetNpiEntry(string npiNumber)
        {
            var npiEntry = await "https://npiregistry.cms.hhs.gov"
                .AppendPathSegment("api/")
                .SetQueryParams(new { version = "2.1", number = npiNumber })
                .GetJsonAsync<RootObject>();

            return npiEntry.Results[0];
        }
    }

    public class RootObject
    {
        public int ResultCount { get; set; }

        public IReadOnlyList<Result> Results { get; set; }
    }

    public class Result
    {
        public int Number { get; set; }
    }
}

这种方式对我有用。