Tabnine Logo
InstagramAuthException.<init>
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using me.postaddict.instagram.scraper.exception.InstagramAuthException.<init> (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<init>

Popular methods of InstagramAuthException

    Popular in Java

    • Creating JSON documents from java classes using gson
    • putExtra (Intent)
    • findViewById (Activity)
    • addToBackStack (FragmentTransaction)
    • InputStreamReader (java.io)
      A class for turning a byte stream into a character stream. Data read from the source input stream is
    • TimerTask (java.util)
      The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
    • ExecutorService (java.util.concurrent)
      An Executor that provides methods to manage termination and methods that can produce a Future for tr
    • Servlet (javax.servlet)
      Defines methods that all servlets must implement. A servlet is a small Java program that runs within
    • DataSource (javax.sql)
      An interface for the creation of Connection objects which represent a connection to a database. This
    • Join (org.hibernate.mapping)
    • Top PhpStorm 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