{ "info": { "author": "Samir Ahmed", "author_email": "blaklites@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "**************************************************************\r\n*Python Sdk for the Facebook Graph Api*\r\n**************************************************************\r\n\r\n| **fb** is a python sdk for the Facebook Graph Api. The sdk provides three methods \r\n| for interacting largely with facebook. publish(), get_object() and delete()\r\n| In addtion to the three, there is one helper method to view the structure of\r\n| objects returned from facebook, show_fields()\r\n\r\n*Installation*\r\n------------------\r\n| **sudo pip install fb**\r\n|\r\n\r\n\r\n*1. Publishing to Facebook*\r\n===========================\r\n| For publishing, use the publish() method. Publishing means creating objects like:\r\n| a wall post, a like, events and albums, etc. Currently photo upload\r\n| is not supported. The method returns the id of the object created.\r\n| At `developers.facebook.com/docs/reference/api/publishing/ `_\r\n| under **'Other Objects'**, see list of publish categories except \"photos\".\r\n\r\n====================================\r\n *Examples*\r\n====================================\r\n| import fb \r\n| # Go to `developers.facebook.com/tools/explorer `_ to generate test token\r\n| token=\"*the facebook token you are going to use*\"\r\n| facebook=fb.graph.api(token)\r\n| \r\n| *#Post on the current user's wall*\r\n| facebook.publish(cat=\"feed\", id=\"me\", message=\"My facebook status\")\r\n| \r\n| *#Like an object(wall post, photo and anything thats likable in facebook) with id=object_id*\r\n| facebook.publish(cat=\"likes\", id=object_id)\r\n|\r\n| *#Comment on an objects thats commentable*\r\n| facebook.publish(cat=\"comments\", id=object_id, message=\"My comment\")\r\n|\r\n| *#Create an album*\r\n| facebook.publish(cat=\"albums\", id=\"me\", name=\"Album Name\", message=\"Album Details\")\r\n|\r\n| *Create an event*\r\n| facebook.publish(cat=\"events\", id=\"me\", name=\"My Event\", start_time=\"2013-10-16-12:20\", end_time=\"2013-10-18-14:30\" )\r\n\r\n*Important*\r\n-----------\r\n| In addition to 'cat' (the category) and 'id', publish takes any parameter thats\r\n| valid for the publish category(cat). Like \"message\" for wall post, \"name\" for albums, \r\n| nothing for likes, etc. Check facebook doc for full list of valid parameters \r\n| for each kind of publishing. If you find that a parameter is raising error, \r\n| it maybe because this sdk does not yet support the parameter,please report such cases \r\n| to the author.\r\n\r\n*2. Fetch Objects from Facebook*\r\n================================\r\n\r\n| Objects can be fetched in two ways using the get_object() method. \r\n| Fetch \"single\" object with it's given \"fields\" passed in a list.\r\n| Or retrieve \"multiple\" objects passed with their \"ids\" in a list.\r\n| The method returns the object as python dictionary containing related fields\r\n\r\n=============================================\r\n*Examples*\r\n=============================================\r\n| *#Retrieve given fields for a single object*\r\n| object=facebook.get_object(cat=\"single\", id=object_id, fields=[\"name\", \"email\" ] )\r\n|\r\n| *#Retrieve ALL fields for a single object*\r\n| object=facebook.get_object(cat=\"single\", id=object_id, fields=[ ] )\r\n|\r\n| *#Rertieve multiple objects*\r\n| object=facebook.get_object(cat=\"multiple\", ids=['zuck', 'me'] )\r\n\r\n*3. Delete Objects*\r\n===================\r\n\r\n| Deleting objects is simple. use the delete method and pass the id of the\r\n| object to be deleted. Note that a \"like\" has no id in facebook, so in case of deleting \r\n| a \"LIKE\", you have to pass the id of the object liked and the category of the delete \r\n| which is \"likes\".\r\n\r\n=============================================\r\n*Examples*\r\n=============================================\r\n| *#Delete a status*\r\n| facebook.delete(id=status_id)\r\n|\r\n| *#Delete a comment*\r\n| facebook.delete(id=comment_id)\r\n|\r\n| *#Delete a \"LIKE\"*\r\n| facebook.delete(cat=\"likes\", id=object_id)\r\n\r\n*4. The Helper Methods*\r\n==============================\r\n\r\n| As of version 0.4.0, there is one helper method, *show_fields()*. Using this method,\r\n| it is possible to view the structure of the objects returned by facebook. This will help\r\n| further manipulate the fetched objects for individual needs.\r\n\r\n=============================================\r\n*Examples*\r\n=============================================\r\n| *#Get \"friends\" and \"education\" of the current user*\r\n| friends_and_education=facebook.get_object(cat='single', id='me', fields=['friends', 'education'])\r\n| *#Display the Structure of the object returned from facebook graph*\r\n| facebook.show_fields(friends_and_education) \r\n|\r\n| The method will print the following:\r\n| ______________________\r\n| education(list)\r\n| school\r\n| id\r\n| name\r\n| type\r\n| year\r\n| id\r\n| name\r\n| friends\r\n| paging\r\n| next\r\n| data(list)\r\n| name\r\n| id\r\n| id\r\n| _______________________\r\n\r\n| The above are all dictionary keys with sub-keys. Some of the keys are prefixed by \"(list)\" \r\n| which means their values are saved inside a list and should be accessed through indexing. \r\n| In line with the structure printed by the method, we can access various parts of the object \r\n| fetched from facebook as shown below\r\n|\r\n| *# \"name\" of schools attended*\r\n| friends_and_education['education'][0]['school']['name']\r\n| friends_and_education['education'][1]['school']['name'] and so on........\r\n|\r\n| *# \"type\" of the nth school in the object*\r\n| friends_and_education['education'][n]['type']\r\n| \r\n| *#\"name\" of the nth friend in the object* \r\n| friends_and_education['friends']['data'][n]['name']\r\n|\r\n| *#\"name\" and \"id\" of all friends*\r\n| friends_and_education['friends']['data']\r\n|\r\n| **Note:**\r\n| The idea behind introducing the show_fields() method is to help developers\r\n| get a visual overview of the internal structure of objects retrieved from facebook graph \r\n| so that they can write their own methods easily to further meet their needs. \r\n\r\n\r\n*Reporting issues*\r\n==================\r\n| Please report bugs `here `_. Or email to *blaklites@gmail.com*", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/blaklites/fb", "keywords": "facebook,facebook-sdk,python-facebook,facebook-graph,facebook-api,facebook-python", "license": "The MIT License (MIT)", "maintainer": "", "maintainer_email": "", "name": "fb", "package_url": "https://pypi.org/project/fb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/fb/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/blaklites/fb" }, "release_url": "https://pypi.org/project/fb/0.4.0/", "requires_dist": null, "requires_python": null, "summary": "Python SDK for the Facebook Graph Api. (Latest Version Overview: Introduced the Helper Methods)", "version": "0.4.0" }, "last_serial": 898204, "releases": { "0.1.0": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "dab4487711f6e18536f08956bb18234f", "sha256": "4a65a1bcdf82cd9b312b032e5639905e69b386a36d578c0f21f2cebb390a9e45" }, "downloads": -1, "filename": "fb-0.2.0.tar.gz", "has_sig": false, "md5_digest": "dab4487711f6e18536f08956bb18234f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4407, "upload_time": "2013-08-12T10:49:04", "url": "https://files.pythonhosted.org/packages/10/ca/2ffbdcaeda1da944346c753b4a5f277c2af5de47295c0b881091ed79a2e0/fb-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "8d22d426e6f525a88007b3c3de43f966", "sha256": "000bf24aa5d4014dcb80d6ec8e2120359c8d14a9ab6a0a446f80f9a3df7f0c8d" }, "downloads": -1, "filename": "fb-0.3.0.tar.gz", "has_sig": false, "md5_digest": "8d22d426e6f525a88007b3c3de43f966", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4774, "upload_time": "2013-08-13T16:30:20", "url": "https://files.pythonhosted.org/packages/2a/8f/257c73343242229f8b5bc805c938e4618a83879795c4c8cac8637728bfb2/fb-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "90ec5dfc563e06dc95d874eafdd71ae8", "sha256": "385d2ceabb295b92689b7ddef9f76cc9cbbb460e5c7aa71e5eb5edc61e1a27b6" }, "downloads": -1, "filename": "fb-0.4.0.tar.gz", "has_sig": false, "md5_digest": "90ec5dfc563e06dc95d874eafdd71ae8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5975, "upload_time": "2013-08-16T16:06:41", "url": "https://files.pythonhosted.org/packages/01/b1/3a9e8b6ea041b09aa4d4a71ff6221d5d154cc3ebd235e085629a2d973d7a/fb-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "90ec5dfc563e06dc95d874eafdd71ae8", "sha256": "385d2ceabb295b92689b7ddef9f76cc9cbbb460e5c7aa71e5eb5edc61e1a27b6" }, "downloads": -1, "filename": "fb-0.4.0.tar.gz", "has_sig": false, "md5_digest": "90ec5dfc563e06dc95d874eafdd71ae8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5975, "upload_time": "2013-08-16T16:06:41", "url": "https://files.pythonhosted.org/packages/01/b1/3a9e8b6ea041b09aa4d4a71ff6221d5d154cc3ebd235e085629a2d973d7a/fb-0.4.0.tar.gz" } ] }