Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Update</strong> this is the solution I came up with. Thanks @DMCS for the FQL suggestion but I just decided to use what I had. I will post the FQL solution up when I get a chance to study the implementation. As you can see this method just makes use of more condensed API calls. </p> <p>Incidentally for future reference the API call limit is <a href="https://stackoverflow.com/questions/8713241/whats-the-facebooks-graph-api-call-limit">600 calls per 600 seconds, per token &amp; per IP</a>, so for every unique IP address, with a unique access token, the number of calls is limited to 1 call per second. I'm not sure what that means for asynchronous calling @Gerrat, but there is that.</p> <pre><code>import json import requests # protected _accessCode = "someaccesscode" _accessStr = "?access_token=" + _accessCode _myID = "someidnumber" r = requests.get("https://graph.facebook.com/" + _myID + "/friends/" + _accessStr) raw = json.loads(r.text) terminate = len(raw["data"]) a = list() for k in range(0, terminate - 1): friendID = raw["data"][k]["id"] friendName = raw["data"][k]["name"] url = ("https://graph.facebook.com/me/mutualfriends/" + friendID + _accessStr) req = requests.get(url) temp = json.loads(req.text) print("Processing: " + str(k + 1) + " of " + str(terminate)) for j in range(0, len(temp["data"])): a.append(friendID + "," + temp["data"][j]["id"] + "," + friendName + "," + temp["data"][j]["name"]) # dump contents to file: outputFile = "C:/Users/franklin/Documents/gen/friendsRaw.csv" output = open(outputFile, "w") print("Dumping to file...") # write all me/friend relationships to file for k in range(0, terminate): output.write(_myID + "," + raw["data"][k]["id"] + ",me," + str(raw["data"][k]["name"].encode("utf-8", "ignore")) + "\n") # write all friend/friend relationships to file for i in range(0, len(a)): output.write(str(a[i].encode("utf-8", "ignore")) + "\n") output.close() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload