Giter Club home page Giter Club logo

batchfb-migrated's People

Contributors

stickfigure avatar

Watchers

 avatar  avatar  avatar

batchfb-migrated's Issues

RequestBuilder should concatenate parameters

The RequestBuilder uses a LinkedHashMap to store the parameter entries. 
However, when two parameters with the same key are used, the addParam method 
will use put on the Map and overwrite a previous parameter with the same key.

I would suggest to test for the existence of the key first and concatenate the 
values by comma , before putting the result back to the Map:

    public void addParam(String name, String value) {
        if (this.params.containsKey(name)) {
            String oldValue = this.params.get(name);
            value = oldValue + "," + value;
        }
        this.params.put(name, value);
    }

A use case would be the batching by hand by putting two ids into the parameter 
list.

Original issue reported on code.google.com by [email protected] on 18 Feb 2011 at 11:47

Problem with returned data

Hi All,

This is my code:
FacebookBatcher batcher = new FacebookBatcher(myAccessToken);
Later<List<FacebookPhoto>> photos = batcher.oldRest("photos.get", new 
TypeReference<List<FacebookPhoto>>(){}, new Param("subj_id", 10542146412L));
System.out.println(photos.get().size());

Unfortunately I receive only 230 elements from 1500.

I didn't see any pages when I want to get more photos from certain group.

The main question is how to get all pictures in a group, regardless of the 
number?

Thanks in advance!


Original issue reported on code.google.com by [email protected] on 16 Aug 2010 at 11:18

support for Specifying dependencies between operations in the request

I was trying to do the example shown by facebook 
(http://developers.facebook.com/docs/reference/api/batch/) where you can use 
JSONPath to chain operations together.  This would be great to get (for 
example) a list of albums and then all the photos in each album in one batch.  

It seems like support for the "name" parameter is required.. or maybe I just 
need an example.  Gave up after a few tries.



Original issue reported on code.google.com by [email protected] on 9 Feb 2012 at 8:27

Improve batching by further delaying requests

If I understand correctly, batchfb queues all requests until it hits the first 
get(). Then the requests are fired, grouped in a most efficient batched way. 
All requests.

batchfb could be even more efficient if only the request is fired that is 
needed for the get() plus the ones that belong to the same batch call. But no 
other.

Potentially, more requests come in after the get() that can be batched with 
other requests still in the queue but not yet accessed by a get(). Thus, 
requests are delayed as much as possible to create as large as possible batches.

Maybe it is done that way already, then please close and ignore.

Original issue reported on code.google.com by [email protected] on 19 Feb 2011 at 9:19

Batch non-paged connection requests

This is related to issue 3.

It seems that some connection requests are not paged by Facebook. First trials 
indicate that the following connection requests could be batched in any case:

- picture
- friends
- accounts
- activities
- books
- interests
- likes
- movies
- music
- television

My hypotheses is that these are connections to pages or users but not to other 
objects with the same name (e.g. the connection links goes to an object link, 
the connection albums goes to an object album). The seem to be of a separate 
connection type which might make the batchable without paging.

Original issue reported on code.google.com by [email protected] on 18 Feb 2011 at 11:56

  • Merged into: #3

Manage exceptions of API

As we all know, the Facebook API is not particularly stable. It also can fail 
for large requests, e.g. when trying to request 1000+ pages in one go.

This is a problem for batchfb. As many requests are batched, the resulting 
query can be quite large. And if it fails, all requests batched in it fail.

However, it could be that smaller batches would have worked.

It would be nice if batchfb could handle these issues automatically, by e.g. 
catching the Exceptions, breaking down the batch into smaller chunks and trying 
to execute them individually.

The break-down strategy could work along two dimensions. It could un-batch 
unrelated requests that got batched together by batchfb. And it could even 
break-apart single requests trying to access a large number of objects.

One approach could be to split the number of requested objects of a failed 
request in half and try the halfs separately. If any of them fails, it is again 
split in half, etc...

The split chunks could be parallelized to not loose too much performance.

Original issue reported on code.google.com by [email protected] on 23 Feb 2011 at 9:43

Support error codes and subcodes provided by facebook graph api

Now Facebook Graph API provides error codes and error subcodes in case of 
exceptions, but batchfb exceptions don't have that codes.

BTW, it would be nice if for every request FacebookBatcher provide also raw 
message response from Facebook. It could be helpful in cases when there is a 
new addition in facebook api, which is not yet supported by batchfb. Error 
codes are good example of such situation. 

Original issue reported on code.google.com by [email protected] on 6 Jan 2014 at 12:45

  • Merged into: #18

ObjectMapper error

What steps will reproduce the problem?

    public class User {
        long id;
        @JsonProperty("first_name") 
        String firstName;
    }

    public FacebookTest() {

        String accessToken = FacebookBatcher.getAppAccessToken(clientId, clientSecret);
        FacebookBatcher facebookBatcher = new FacebookBatcher(accessToken);

        GraphRequest<JsonNode> bob = facebookBatcher.graph("user");
    }

What is the expected output? What do you see instead?

Exception in thread "main" java.lang.NoSuchMethodError: 
org.codehaus.jackson.map.ObjectMapper.getTypeFactory()Lorg/codehaus/jackson/map/
type/TypeFactory;
    at com.googlecode.batchfb.impl.Batch.graph(Batch.java:154)
    at com.googlecode.batchfb.impl.Batch.graph(Batch.java:170)

What version of the product are you using? On what operating system?

2.1.2 
MacOS X Lion

Original issue reported on code.google.com by [email protected] on 1 Jul 2012 at 10:15

appsecret_proof support

What steps will reproduce the problem?
1. In facebook, go to Application, Settings, Advanced, Client Token, toggle Yes 
on "App Secret Proof for Server API calls"
2. In the code, try to get a photo using "photo/{id}" as the resource
3. The exception "com.googlecode.batchfb.err.PermissionException: API calls 
from the server require an appsecret_proof argument" will be thrown

What is the expected output? What do you see instead?
The response for the picture.  What I get instead is the aforementioned 
exception.

What version of the product are you using? On what operating system?
2.1.5


Original issue reported on code.google.com by [email protected] on 3 Feb 2015 at 8:14

BinaryParam

As I found on some forum, You plan to implement querying with BinaryParam, What 
about this issue?

Original issue reported on code.google.com by [email protected] on 6 Jun 2012 at 7:42

Batch FQL query return order gets muddled up

What steps will reproduce the problem?
1. Send more than 10 (say 16) FQL queries by calling FacebookBatcher.query in 
the following order 
query1, query2, ... , query9, query10, query11, ... query 16

What is the expected output? What do you see instead?

Expected order of FQL results:
result1, result2, ..., result9, result10, result11, ..., result16
Actual order of FQL results:
result1, result11, result 12, result 13, result, 14, result 15, result 16, 
result2, result3, ..., result9

What version of the product are you using? On what operating system?
batchfb 2.1

Please provide any additional information below.
The following amendment of batchfb source code solved the problem for me:
in Batch.java, line 269, change
String name = "__q" + this.generatedQueryNameIndex++;
to
String name = "__q" + (this.generatedQueryNameIndex < 10 ? "0" : "") + 
this.generatedQueryNameIndex++;

Original issue reported on code.google.com by [email protected] on 5 Aug 2011 at 5:36

ErrorDetectingWrapper should throw specific exceptions

What steps will reproduce the problem?
1. Perform a graph request with an expired or de-authed token
2. A generic FacebookException is thrown instead of OAuthException e.g.

com.googlecode.batchfb.err.FacebookException: Error validating access token: 
User X has not authorized application Y.(OAuthException)

Please provide any additional information below:
Just add a catch for FacebookException to the checkForStandardGraphError method 
and rethrow the specific exception instead of catching it and creating a 
generic one.

try {
  Class<?> exceptionClass = Class.forName(proposedExceptionType);
  Constructor<?> ctor = exceptionClass.getConstructor(String.class);
  throw (FacebookException)ctor.newInstance(msg);
} catch (FacebookException e) {
  throw e;
} catch (Exception e) {
  throw new FacebookException(msg + "(" + type + ")");
}

Or change the generic catch Exception to catch the instantiation exceptions 
InstantiationException,IllegalAccessException, IllegalArgumentException, 
InvocationTargetException

Original issue reported on code.google.com by [email protected] on 24 Jan 2012 at 7:01

Support error codes and subcodes provided by facebook graph api

Now Facebook Graph API provides error codes and error subcodes in case of 
exceptions, but batchfb exceptions don't have that codes.

BTW, it would be nice if for every request FacebookBatcher provide also raw 
message response from Facebook. It could be helpful in cases when there is a 
new addition in facebook api, which is not yet supported by batchfb. Error 
codes are good example of such situation. 


Original issue reported on code.google.com by [email protected] on 6 Jan 2014 at 12:42

PagedLater not handling null URL on next()

PagedLater<FacebookCompanyAccountData> accounts =
    batcher.paged(facebookCredentials.getUserId() + "/accounts",
    FacebookCompanyAccountData.class);
saveAccounts(accounts, companyToken);
accounts = accounts.next();
while (accounts != null)
{
    saveAccounts(accounts, companyToken);
    accounts = accounts.next();
}

The first time through (accounts.get via saveAccounts()), I see:

 {
   "data": [
     {
       "category": "foo",
       "name": "bar",
       "access_token": "mytoken",
       "id": "1",
       "perms": [
         "ADMINISTER",
         "EDIT_PROFILE",
         "CREATE_CONTENT",
         "MODERATE_CONTENT",
         "CREATE_ADS",
         "BASIC_ADMIN"
       ]
     }
   ],
   "paging": {
     "next": "https://graph.facebook.com/myId/accounts?limit=5000&offset=5000&__after_id=aboveId"
   }
}

When accounts.next() is called the first time, the result is:

{
   "data": [

   ],
   "paging": {
      "previous": "https://graph.facebook.com/byId/accounts?limit=5000&offset=0&access_token=mytoken"
   }
}

This saves nothing (since data is empty) and then when accounts.next() is 
called inside the while loop, I get a null pointer exception:

Caused by: java.net.MalformedURLException: null
    at java.net.URL.<init>(Unknown Source) ~[na:1.7.0_21]
    at java.net.URL.<init>(Unknown Source) ~[na:1.7.0_21]
    at java.net.URL.<init>(Unknown Source) ~[na:1.7.0_21]
    at com.googlecode.batchfb.util.URLParser.<init>(URLParser.java:67) ~[batchfb-2.1.3.jar:na]
    ... 40 common frames omitted
Caused by: java.lang.NullPointerException: null
    ... 44 common frames omitted

This caused by the fact that in the next() method of PagedLaterAdapter:

    @Override
    public PagedLater<T> next()
    {
        if (this.request.get().getPaging() == null)
            return null;
        else
            return this.createRequest(this.request.get().getPaging().getNext());
    }

the call to 'this.request.get().getPaging().getNext()' has a null result.

During the call to createRequest, you try to construct a 'newUrlParser' with 
this null parameter which then throws the NPE in the first line of this 
constructor of URLParser:

    public URLParser(String url) {
        try {
            this.parsed = new URL(url);
            this.params = parseQuery(this.parsed.getQuery());

        } catch (MalformedURLException e) { throw new RuntimeException(e); }
    }

It looks as if you need to perform a check for this in next() of 
PagedLaterAdapter and return null instead of trying to create the request.

I an on Windows 7, Java 7 and batchfb 2.1.3.

Original issue reported on code.google.com by [email protected] on 21 Jun 2013 at 9:41

PagedLater does not find an end (null)

Using the following approach falls into an endless loop:

PagedLater<PageConnection> rConnection = batcher.paged("me/albums", 
PageConnection.class);
while (rConnection != null) {
  for (PageConnection connection : rConnection.get()) {
    System.out.println(connection.getName());
  }
  rConnection = rConnection.next();
}

Expectation would be that eventually rConnection.next() produces a null value 
when no next page exists. However, that doesn't happen. It seems to be 
Facebook's fault, though. Accessing the graph by hand shows that the last 
"next" link points to a new page containing the last entry from the previous 
page once more. It is therefore logical that batchfb cannot find an end.

If this is more than a temporary Facebook glitch, batchfb could employ some 
caching and test if a new page contains just one element which happens to be 
the same as the last element of the previous page, in which case the end is 
reached and "null" can be returned by next.

Or maybe I don't understand the proper usage of next() here?

Original issue reported on code.google.com by [email protected] on 19 Feb 2011 at 1:18

  • Merged into: #17

Batch paged connection requests

The documentation says that paged requests can not be batched together and are 
executed as single calls.

However, the following is a valid API call:
https://graph.facebook.com/events?ids=me,1330376002&access_token=...

It returns an array of two paged event results. Can we not find a way of making 
the retrieval of connections more efficient?

Original issue reported on code.google.com by [email protected] on 18 Feb 2011 at 7:21

Provide some convenience integration with restfb classes

batchfb is a great complement to restfb. One advantage of restfb is that it 
provides some canned classes for Graph objects. While it is a pain to keep them 
up-to-date, it is a great start and help.

It would be very nice if batchfb could make use of these classes. 
Unfortunately, since restfb uses its own JSON tools with @Facebook annotation, 
it is not really compatible with Jackson and its annotations.

While Jackson supports mix-in annotations, I'm not sure how straight forward it 
is to use the restfb classes without rewriting all the interfaces (which is 
pretty close to rewrite the whole classes).

Would it be possible to add some automatic support that accepts the @Facebook 
annotation of restfb with Jackson in batchfb?

Original issue reported on code.google.com by [email protected] on 19 Feb 2011 at 8:10

MultipartWriter.write() does not close its writer

Before the move to Maven with batchfb 2.1.3, I used a patched version of 2.1.2 
with a modification in com.googlecode.batchfb.util.MultipartWriter.

At the end of the write(Map<String, Object> params) method, I added the line
writer.close();
because the writer is never closed (as per the Eclipse warning). Only 
writer.flush() is called.

I noticed that 2.1.3 added "@SuppressWarnings("resource")" instead of closing 
the writer. This doesn't seem right and I can't find why this is the case from 
svn revision 142 which introduced the change.

I suggest either adding a comment justifying the @SuppressWarnings or closing 
the writer properly and removing the annotation.

Original issue reported on code.google.com by [email protected] on 12 Apr 2013 at 12:13

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.