App-DuckPAN

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  Date : 2014-07-29 14:41:16 +0000

    Web.pm: Switch fallback server to ddh1.duckduckgo.com

    I would like to change the default fallback server to DDH1 so that
    people can have access to private APIs.

    We sometimes get pull requests from partners that don't have signup
    pages for APIs. When this happens, only people in DDG have the
    capability to actually check the API. But when we point it to DDH1, I
    can deploy the endpoint there and people will be able to play with it
    on their own DuckPAN installations.

    Flow:

    1. DuckPAN checks if the env variable is available. 2. If it is, it
    makes a request to the API endpoint. 3. If it isn't, it makes a
    request to ddh1. 

  Change: accb1237c0f921f781bc218416368215548f58cd
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2014-07-24 10:24:51 +0000

    Small update to phrasing 

  Change: 08e7062e9a065c0cb4329cdc4557da01f850d5fb
  Author: Zaahir Moolla <moollaza@duckduckgo.com>

Changes  view on Meta::CPAN

  Date : 2014-03-06 14:05:38 +0000

    Document installdeps/roadrunner 

  Change: c9b58e0d624b338db8157c09b56ba7be44aa258b
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2014-03-05 16:05:32 +0000

    Merge pull request #62 from duckduckgo/jag/web/missing-api-keys

    DuckPAN/Web: Default to DDG's endpoint if API key is missing. 

  Change: 5a3c1fca372e82bdb006896c83dc24150877b7e0
  Author: Jag Talon <jagtalon@duckduckgo.com>
  Date : 2014-03-04 16:25:56 +0000

    DuckPAN/Web: Remove else block. 

  Change: 3c1517d0eaf548f7275fa40ac9c29218a72d789f
  Author: Jag Talon <jagtalon@duckduckgo.com>
  Date : 2014-03-04 13:37:44 +0000

    DuckPAN/Web: Default to DDG's endpoint if API key is missing.

    The lack of publicly available API keys have prevented open-source
    developers from correctly fixing / testing Spice instant answers
    without DDG's help. The developer, especially new ones, will run into
    one of these two problems:

    1. She has to register for an API key for an instant answer she has
    to fix. 2. She cannot register for an API key at all (because the API
    key was exclusively given to DDG).

lib/App/DuckPAN/Web.pm  view on Meta::CPAN

							$post_body =~ s/$cap_from//g;
						}
					}
					# Make sure we replace "${dollar}" with "$".
					$to =~ s/\$\{dollar\}/\$/g;

					my ($wrap_jsonp_callback, $callback, $wrap_string_callback, $missing_envs, $headers) =
						($rewrite->wrap_jsonp_callback, $rewrite->callback, $rewrite->wrap_string_callback, defined($rewrite->missing_envs), $rewrite->headers);

					# Check if environment variables (most likely the API key) is missing.
					# If it is missing, switch to the DDG endpoint.
					my ($use_ddh, $request_uri);
					if ($missing_envs) {
						++$use_ddh;
						$request_uri = $request->request_uri;
						 # Display the URL that we used.
						 print "\nAPI key not found. Using DuckDuckGo's endpoint:\n";
					}

					$to = "https://beta.duckduckgo.com$request_uri" if $use_ddh;

					my $h = HTTP::Headers->new( %$headers );
					my $res;
					my $req;

					if ( $post_body && !$use_ddh ) {
						$req = HTTP::Request->new(



( run in 0.827 second using v1.01-cache-2.11-cpan-b61123c0432 )