class PyPiVerifier implements DigestVerifier {

  @Override
  public List<LibraryId> verify(final Library _lib) throws VerificationException {
    if (_lib == null || _lib.getDigest() == null)
      throw new IllegalArgumentException("No library or digest provided: [" + _lib + "]");

    if (_lib.getLibraryId() == null
        || _lib.getLibraryId().getMvnGroup() == null
        || _lib.getLibraryId().getVersion() == null) return null;

    this.url =
        "https://pypi.python.org/pypi/<name>/<version>/json"
            .replaceAll("<name>", _lib.getLibraryId().getMvnGroup())
            .replaceAll("<version>", _lib.getLibraryId().getVersion());

    String response_body = null;
    List<LibraryId> verified_lids = null;
    int sc = -1;
    try {
      final CloseableHttpClient httpclient = HttpClients.createDefault();
      final HttpGet method = new HttpGet(this.url);
      if (ConnectionUtil.getProxyConfig() != null)
        method.setConfig(ConnectionUtil.getProxyConfig());
      final CloseableHttpResponse response = httpclient.execute(method);
      try {
        sc = response.getStatusLine().getStatusCode();
        HttpEntity entity = response.getEntity();
        if (sc == HttpStatus.SC_OK && entity != null) {
          response_body = ConnectionUtil.readInputStream(entity.getContent());
          verified_lids = new ArrayList<LibraryId>();
          if (this.containsMD5(response_body, _lib.getDigest()))
            verified_lids.add(_lib.getLibraryId());
        }
      } finally {
        response.close();
      }
    } catch (Exception e) {
      throw new VerificationException(_lib, this.url, e);
    }
    return verified_lids;
  }

  public  PyPiVerifier();

}