Giter Site home page Giter Site logo

node-flickr's Introduction

node-flickr

A simple node wrapper for the Flickr API that supports oAuth authentication

This is a small library that adds a thin wrapper around the Flickr API to make it easier to call methods, sign them when necessary.

It currently does not support the RSS/Atom feeds, nor does it handle the oAuth login process. It may in the future -- I'd appreciate any patches if you have time.

The library is heavily inspired by the flickrnode library by Ciaran Jessup.

Current Test Status: Build Status

Usage

Install the library into your package.json file or using the following command:

npm install flickr

Once installed, you can interact with the library with something like this:

var Flickr = require('flickr').Flickr;

var client = new Flickr('YOUR_CONSUMER_KEY/API_KEY', 'YOUR_CONSUMER_SECRET', 
                        {"oauth_token": 'optional oauth token', "oauth_token_secret": 'optional oauth token secret'});

Some examples follow.

Examples

var flickr = new Flickr(flickr_api_key, flickr_api_secret);

var flickr_params = {
	text: "soccer",
	media: "photos",
	per_page: 25,
	page: 1,
	extras: "url_q, url_z, url_b, owner_name"
};

flickr.executeAPIRequest("flickr.photos.search", flickr_params, false, function(err, result) {
		// Show the error if we got one
		if(err) {
			console.log("FLICKR ERROR: " + err);

			return;
		}

		// Do something with flicker photos
		doSomething(result.photos)

Development

Contributions are welcome. Please feel free to submit pull requests. I prefer that pull requests come from properly named feature branches (don't dev in master!). This makes it easier for people scanning the Network tab above to see what your fork offers.

Running tests

To setup your local copy for testing, I recommend you run

npm link

in the project directory to install all the dependencies. I found that easiest.

Next, create a .env file in the root of the project directory. The Makefile sets up the testing environment to use those values. Yes, the tests run against the live API (for now).

You should probably start with the following contents:

FLICKR_API_KEY=<Your API Key>
FLICKR_API_SECRET=<Your API Secret>
FLICKR_OA_TOKEN=<A valid access token>
FLICKR_OA_TOKEN_SECRET=<A valid access token secret>

To get the access token and the access token secret, you will need to go through the OAuth dance. You can use something like this OAuth test client to generate those values. Using that tool is beyond the scope of this readme.

Then, whenever you want to run tests:

make test

You should get a nicely formatted output for your tests. You can also override the reporter used by Mocha by setting a REPORTER value in .env. Read the Makefile for details.

License

See the LICENSE file for details.

node-flickr's People

Contributors

sujal avatar gabceb avatar amusesmile avatar

Stargazers

Frank van Es avatar Anand Thakker avatar Brian Clarke avatar Brad Strong avatar Roland Tanglao avatar Richard Eriksson avatar Igor Ribeiro Lima avatar C Dorn avatar Charles Cai avatar Steven Fusco avatar  ✨Eloone avatar Tom Hickey avatar  avatar Eunjae Lee avatar Stefan Adolf avatar Eric Chuang avatar node-migrator-bot avatar Sascha avatar Christoph avatar Vinicius Gama avatar Sheng-Ho Yuan avatar tim walker avatar Pradeep B V avatar  avatar

Watchers

 avatar Roland Tanglao avatar James Cloos avatar

node-flickr's Issues

Push new version to npm

The current code seems to have fixed the SSL problem described on #1. Please push new version to npm

Support Flickr's change to SSL only

Flickr is changing to SSL only for access to the API.

I had a look to see what was involved in upgrading node-flickr and it doesn't seem completely simple - http.createClient is deprecated so it would require changing to https.request which has slightly different semantics.

If I get a chance I'll try to provide a patch but I thought I'd give you a heads-up incase you have a solution in the works...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.