Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appnexus-api

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appnexus-api

Appnexus client for node.js

  • 0.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by25%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

appnexus-api

appnexus-api is an easy-to-use Appnexus client for node.

Install

$ npm install appnexus-api

Request throttling

This library throttle requests to respect Appnexus limits:

  • Max 10 authentications per 5 minute period
  • Max 60 writes per minute
  • Max 100 reads per minute

Usage

See system tests.

Keep authenticated

Appnexus token is valid for 2 hours. Appnexus recomends to listen for the
"NOAUTH" error and then reauthenticate.
This library does not implement that behavior.

Here is an example of continuous authentication.

var Appnexus = require('appnexus-api'),
reauthenticateEvery = 60*60*1000;
reauthenticateRetry = 500;

(function authenticate() {
    self.client.authenticate(function (err, token) {
        if (err) {
            self.emit('error', err);
            setTimeout(authenticate, reauthenticateRetry);
        } else {
            self.client.token = token;
            setTimeout(authenticate, reauthenticateEvery);
        }
    });
}());

In the example the client try to reauthenticate every hour.
If it fails, it will keep trying retry every 500 ms. Request throttle will prevent
exceeding appnexus authentication request limits.

Unit testing

You can use mocha with your preferred options or just make test-unit

Test against Appnexus endpoint

You can run the system tests against an Appnexus like system.
Before you run them, double check that your environment is set up.
For instance you can create a testing-env.sh shell script like:

# Appnexus testing environment credentials
export APPNEXUS_USERNAME=johndoe
export APPNEXUS_PASSWORD=secret
export APPNEXUS_ENDPOINT=http://sand.api.appnexus.com

And add it to your working environment with $ . ./testing-env.sh then

$ npm test

or

$ make test-system

System tests are instrumentalised using the excellent debug library.

Bitdeli Badge

Keywords

FAQs

Package last updated on 02 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc