Google +语言编程使用people.list

本文关键字:people list 语言编程 Google | 更新日期: 2023-09-27 18:05:07

作为一名新研究员,我正试图获得有关G+上人们之间关系的信息。我想要别人的圈子列表做一些研究。G+ API似乎提供了一个网络版本供人们使用。带有OAuth2令牌的列表。我的问题是,人们。列表支持编程语言,如c#, java?我尝试使用c#,但它似乎被服务器阻止了。

有没有一种方法来应用人们。列表在c#,java等?如果有,有样品吗?或者有人提供一些开放的代码来实现类似的功能?

非常感谢。

下面是我相关的c#代码:
var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description)
                {
                    ClientIdentifier = credentials.ClientId,
                    ClientSecret = credentials.ClientSecret
                };
            var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);

        var servicelist = new PlusService(new BaseClientService.Initializer()
        {
            Authenticator = auth
        });
        string userId = "********************";
        PeopleResource.ListRequest circle = servicelist.People.List(userId, new PeopleResource.Collection());
        circle.MaxResults = 5;
        PeopleFeed danielfeed = circle.Fetch();

    private static IAuthorizationState GetAuthorization(NativeApplicationClient arg)
    {
        IAuthorizationState state = new AuthorizationState(new[] { TasksService.Scopes.Tasks.GetStringValue() });
        state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
        Uri authUri = arg.RequestUserAuthorization(state);
        Process.Start(authUri.ToString());
        Console.Write("  Authorization Code: ");
        string authCode = Console.ReadLine();
        Console.WriteLine();
        return arg.ProcessUserAuthorization(authCode, state);
    }
}

程序在"PeopleFeed danielfeed = circle.Fetch();"处出错我想我已经把OAuth令牌传递给了人们。按变量auth列出函数。你能给我一些建议吗?

Google +语言编程使用people.list

Google's People:list API的文档在这里。整个API是RESTful的,并且不阻止任何语言。

你可以使用c#,只需要学习如何在c#中使用REST API。你想要使用的c#类是HttpClient类。这里有很好的文档,网上有很多教程,还有SO.

相关文章: