fxjordan / botometer-java

Java library to detect Twitter bot accounts using the Botometer API. Botometer is a bot detection service for Twitter accounts developed by OSoMe.
https://botometer.iuni.iu.edu
Apache License 2.0
4 stars 3 forks source link

Make Botometer API URL configurable (but with default value) #5

Closed fxjordan closed 4 years ago

fxjordan commented 4 years ago

Recently OSoMe changed the API URL at RapidAPI. If this changes again it may be useful for the user to configure the URL themself.

[...] the Botometer URL is hardcoded at the moment: https://github.com/fxjordan/botometer-java/blob/0c75bdc900672a20a2daede062733afa427b0db5/botometer-client/src/main/java/de/fjobilabs/botometer/client/DefaultBotometerClient.java#L46

We should make the URL configurable through BotometerConfiguration and provide the new URL as a default value.

Originally posted by @fxjordan in https://github.com/fxjordan/botometer-java/issues/4#issuecomment-661938432

fxjordan commented 4 years ago

Usage:

BotometerConfiguration config = new BotometerConfigurationBuilder()
    .botometerCheckAccountsEndpoint("https://my-custom-botometer.com/endpoint")
    .botometerApiKey("Botometer-API-Key") // X-RapidAPI-Key
    .twitterConsumerKey("consumer-key")
    .twitterConsumerSecret("consumer-secret")
    .twitterAccessToken("access-token")
    .twitterAccessTokenSecret("access-token-secret")
    .build();