当前位置: 首页>>代码示例>>Java>>正文


Java Credentials.script方法代码示例

本文整理汇总了Java中net.dean.jraw.http.oauth.Credentials.script方法的典型用法代码示例。如果您正苦于以下问题:Java Credentials.script方法的具体用法?Java Credentials.script怎么用?Java Credentials.script使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.dean.jraw.http.oauth.Credentials的用法示例。


在下文中一共展示了Credentials.script方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ScraperBot

import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public ScraperBot() throws OAuthException {
    UserAgent agent = UserAgent.of("script", "io.github.<username>", "v0.1", "<username>");
    client = new RedditClient(agent);

    Credentials cred = Credentials.script("<username>", "<password>", "<public key>", "<private key>");
    OAuthData data = client.getOAuthHelper().easyAuth(cred);

    client.authenticate(data);

    posts = new HashMap<>();
}
 
开发者ID:nikmanG,项目名称:DailyProgrammer,代码行数:12,代码来源:ScraperBot.java

示例2: init

import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public void init() {
    log.info("got here");
    try {
        UserAgent myUserAgent = UserAgent.of("desktop", "com.flowchat", "v0.1", "dessalines");
        redditClient = new RedditClient(myUserAgent);
        Credentials credentials = Credentials.script(DataSources.PROPERTIES.getProperty("reddit_username"),
                DataSources.PROPERTIES.getProperty("reddit_password"),
                DataSources.PROPERTIES.getProperty("reddit_client_id"),
                DataSources.PROPERTIES.getProperty("reddit_client_secret"));
        OAuthData authData = redditClient.getOAuthHelper().easyAuth(credentials);
        redditClient.authenticate(authData);
    } catch (OAuthException e) {
        e.printStackTrace();
    }
}
 
开发者ID:dessalines,项目名称:flowchat,代码行数:16,代码来源:RedditImporter.java

示例3: buildCredentials

import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
private Credentials buildCredentials(){
    String username = properties.getProperty("credentials.username");
    String password = properties.getProperty("credentials.password");
    String clientId = properties.getProperty("credentials.client.id");
    String clientSecret = properties.getProperty("credentials.client.secret");
    String redirectUrl = properties.getProperty("credentials.redirect.url");

    return Credentials.script(username, password, clientId, clientSecret, redirectUrl);
}
 
开发者ID:vitalijzad,项目名称:java-rss-for-reddit,代码行数:10,代码来源:RedditSubmitter.java

示例4: authenticate

import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public AuthHelper authenticate() throws NetworkException, OAuthException{
	AuthHelper helper = new AuthHelper();
	UserAgent myUserAgent = UserAgent.of("desktop", "YouTubeBot", "0.1", "-YouTubeBot-");
	RedditClient redditClient = new RedditClient(myUserAgent);
	Credentials credentials = Credentials.script("-YouTubeBot-", "Ash3win#", "WnBQphrJ2jWY5A", "bJmaYXBDHUNfPGRpSEUPHOtLrIk");
	OAuthData authData = redditClient.getOAuthHelper().easyAuth(credentials);
	redditClient.authenticate(authData);
	helper.setCredentials(credentials);
	helper.setRedditClient(redditClient);
	return(helper);
}
 
开发者ID:ashwinswaroop,项目名称:YouTubeBot,代码行数:12,代码来源:Authenticator.java

示例5: authReddit

import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public static RedditClient authReddit() throws OAuthException {
    System.out.println("Reauthenticating Reddit");
    Credentials credentials = Credentials.script("DiscordPastaBot", Keys.RedditPass, Keys.RedditID, Keys.RedditSecret);
    redditClient.authenticate(redditClient.getOAuthHelper().easyAuth(credentials));
    return redditClient;
}
 
开发者ID:nbd9,项目名称:PastaBot,代码行数:7,代码来源:Reddit.java


注:本文中的net.dean.jraw.http.oauth.Credentials.script方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。