Tabnine Logo
InstagramAuthException
Code IndexAdd Tabnine to your IDE (free)

How to use
InstagramAuthException
in
me.postaddict.instagram.scraper.exception

Best Java code snippets using me.postaddict.instagram.scraper.exception.InstagramAuthException (Showing top 4 results out of 315)

origin: postaddictme/instagram-java-scraper

  @Override
  public Response intercept(Chain chain) throws IOException {
    Response response = chain.proceed(chain.request());
    int code = response.code();

    if (code == 200) {
      return response;
    } else {
      response.body().close();
    }

    switch (code) {
      case 401:
        throw new InstagramAuthException("Unauthorized");
      case 403:
        throw new InstagramAuthException("Access denied");
      case 404:
        throw new InstagramNotFoundException("Resource does not exist");
      default:
        throw new InstagramException("Response code is not equal 200. Something went wrong. Please report issue.");
    }
  }
}
origin: postaddictme/instagram-java-scraper

  @Override
  public Response intercept(Chain chain) throws IOException {
    Response response = chain.proceed(chain.request());
    int code = response.code();

    if (code == 200) {
      return response;
    } else {
      response.body().close();
    }

    switch (code) {
      case 401:
        throw new InstagramAuthException("Unauthorized");
      case 403:
        throw new InstagramAuthException("Access denied");
      case 404:
        throw new InstagramNotFoundException("Resource does not exist");
      default:
        throw new InstagramException("Response code is not equal 200. Something went wrong. Please report issue.");
    }
  }
}
origin: postaddictme/instagram-java-scraper

public void login(String username, String password) throws IOException {
  if (username == null || password == null) {
    throw new InstagramAuthException("Specify username and password");
  }else if(this.csrf_token.isEmpty()) {
    throw new NullPointerException("Please run before base()");
  }
  RequestBody formBody = new FormBody.Builder()
      .add("username", username)
      .add("password", password)
      .build();
  Request request = new Request.Builder()
      .url(Endpoint.LOGIN_URL)
      .header(Endpoint.REFERER, Endpoint.BASE_URL + "/")
      .post(formBody)
      .build();
  Response response = executeHttpRequest(withCsrfToken(request));
  try(InputStream jsonStream = response.body().byteStream()) {
    if(!mapper.isAuthenticated(jsonStream)){
      throw new InstagramAuthException("Credentials rejected by instagram");
    }
  }
}
origin: postaddictme/instagram-java-scraper

public void login(String username, String password) throws IOException {
  if (username == null || password == null) {
    throw new InstagramAuthException("Specify username and password");
  }else if(this.csrf_token.isEmpty()) {
    throw new NullPointerException("Please run before base()");
  }
  RequestBody formBody = new FormBody.Builder()
      .add("username", username)
      .add("password", password)
      .build();
  Request request = new Request.Builder()
      .url(Endpoint.LOGIN_URL)
      .header(Endpoint.REFERER, Endpoint.BASE_URL + "/")
      .post(formBody)
      .build();
  Response response = executeHttpRequest(withCsrfToken(request));
  try(InputStream jsonStream = response.body().byteStream()) {
    if(!mapper.isAuthenticated(jsonStream)){
      throw new InstagramAuthException("Credentials rejected by instagram");
    }
  }
}
me.postaddict.instagram.scraper.exceptionInstagramAuthException

Most used methods

  • <init>

Popular in Java

  • Start an intent from android
  • getApplicationContext (Context)
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Permission (java.security)
    Legacy security code; do not use.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now