GithubHelp home page GithubHelp logo

kevinstrong / flickr4java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from boncey/flickr4java

0.0 0.0 0.0 5.7 MB

Java API For Flickr. Fork of FlickrJ

License: BSD 2-Clause "Simplified" License

Java 100.00%

flickr4java's Introduction

Flickr4Java

Introduction

Note: This API has been forked from FlickrJ at Sourceforge.

This is a Java API which wraps the REST-based Flickr API.

Comments and questions should be raised on the GitHub Repo issue tracker.

Usage

To use the API just construct an instance of the class com.flickr4java.flickr.test.Flickr and request the interfaces which you need to work with.
For example, to send a test ping to the Flickr service:

String apiKey = "YOUR_API_KEY";
String sharedSecret = "YOUR_SHARED_SECRET";
Flickr f = new Flickr(apiKey, sharedSecret, new REST());
TestInterface testInterface = f.getTestInterface();
Collection results = testInterface.echo(Collections.EMPTY_MAP);

See /src/examples/java for more.

Setting User-Agent

Since version 3.0.7 Flickr4Java passes the following User-Agent header in its requests

Flickr4Java/3.x

If you want to override that and set your own you can pass in your own value. Note that no validation is performed on the provided string.

REST transport = new REST();
transport.setUserAgent("MyUserAgent/0.1");
Flickr f = new Flickr(apiKey, sharedSecret, transport);

Requirements

This API has been tested and built with JDK 1.8.

An API key is required to use this API. You can request one on Flickr.

Required libraries

See here for details on how to choose and configure an SLF4J logging library.

Gradle

compile 'com.flickr4java:flickr4java:3.0.8'

Maven

<dependency>
  <groupId>com.flickr4java</groupId>
  <artifactId>flickr4java</artifactId>
  <version>3.0.8</version>
</dependency>

Flickr4Java is available on Maven Central so the above settings should be all you need.

Testing

The tests now run against captured responses from Flickr (see src/test/resources/payloads) and don't contact the Flickr API at all.
This means there is no longer any need to create a test account and populate a properties file.

Functional testing against the Flickr API.

This is the setup to run the tests against the Flickr API.
Not for the faint-hearted. Only do this to test large refactorings etc.

Create up a setup.properties file (see src/test/resources/setup.properties.example) with details of a real account on Flickr (I recommend setting up a test account for this purpose).
Run tests as follows.

mvn -DsetupPropertiesPath=/path/to/your/setup.properties clean install

Expect lots of failures and general flakiness as data has changed on Flickr and the tests or data need updating.

Dependency checker

OWASP dependency-check is configured in the pom.xml.

To run a dependency check

mvn -U clean verify -P dependency-check

flickr4java's People

Contributors

boncey avatar callmeal avatar tague avatar mike10004 avatar artikulant avatar e-penguin avatar samwilson avatar allentiak avatar hytgbn avatar bryancresswell avatar farnulfo avatar perrygeorget avatar hugal31 avatar jonhare avatar kevinstrong avatar linus12 avatar devniall avatar szabobalint-virgo avatar don-vip avatar dependabot[bot] avatar haggisandchips avatar tdmitriy avatar ihcsim avatar jjhesk avatar kewang avatar qduc avatar robfrank avatar vermgit avatar

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.