Skip to main content

Facepy makes it really easy to interact with Facebook's Graph API

Project description


.. image::

Facepy makes it really easy to interact with Facebook's Graph API.



from facepy import GraphAPI

# Initialize the Graph API with a valid access token (optional,
# but will allow you to do all sorts of fun stuff).
graph = GraphAPI(oauth_access_token)

# Get my latest posts

# Post a photo of a parrot
path = 'me/photos',
source = open('parrot.jpg', 'rb')

Facepy can do more than reading your latest posts and posting photographs of parrots, but you'll have to
`read the documentation <>`_ to find out how.



$ pip install facepy


* Fork `the repository <>`_.
* Do your thing (preferably on a feature branch).
* Write a test that demonstrates that the bug was fixed or the feature works as expected.
* Send a pull request and bug me until I merge it!

I love you

Johannes Gorset made this. You should `tweet me <>`_ if you can't get it
to work. In fact, you should tweet me anyway.

I love Hyper

I work at Hyper with a bunch of awesome folks who are all every bit as passionate about good code
as myself. If you're using this library, we probably want to hire you.



* ``FacebookError``, ``HTTPError``, ``OAuthError`` and ``SignedRequestError`` are now available
from the ``facepy`` module for convenience.
* ``GraphAPI`` now raises ``FacebookError`` upon receiving HTTP 500 from Facebook.


* ``GraphAPI`` now accepts an argument ``timeout``, which can be either ``None`` or an
integer describing how many seconds to wait for a response.


* Fixed an issue where *six* would cause an ``ImportError`` unless already
installed. It is now a direct dependency.


* ``GraphAPI`` now supports securing Graph API requests with application secret proofs.
* ``GraphAPI#post`` now supports user-generated images.
* The last bit of the tuple returned from ``get_extended_access_token`` is now ``None``
if the access token won't expire.
* ``GraphAPI#batch`` can now handle more than 50 requests at a time.
* Fixed a bug that caused unicode URLs to fail.


* Changed ``GraphAPI`` methods to return ``decimal.Decimal`` instances for
floating-point numbers instead of ``float``, which can cause precision
losses not acceptable for financial operations.
* Fixed a bug that caused parsing signed requests to fail when the ``user`` key
is not present.
* Nested dictionaries, lists and sets are now automatically encoded as JSON.
* You may now elect to not verify Facebook's SSL certificate.
* You may now substitute colons with underscores in keys such as ``fb:explicitly_shared``.
* Facepy is now compatible with Python 3.


* Fixed a bug that caused a KeyError for signed requests that were missing
some keys for its "page" attribute.


* Fixed a bug that caused batch requests with a body to fail.
* You may now extend access tokens with ``get_extended_access_token``.
* Fixed a bug that caused paths that started with a slash to fail.
* Fixed a bug that caused exception messages to be omitted.


* Facepy exceptions may now be pickled.


* Fixed a bug that caused pagination to stop prematurely.


* You may now query application access tokens with ``get_application_access_token``.
* ``SignedRequest.parse`` now returns a dictionary describing the payload of the signed request
instead of a ``SignedRequest`` instance.
* ``SignedRequest.__init__`` now accepts arguments ``signed_request`` and ``application_secret_key`` and no longer
facilitates for constructing arbitrary signed requests.
* ``SignedRequest#generate`` no longer requires the provision of ``application_secret_key``.
* ``SignedRequest#oauth_token`` and ``SignedRequest.OAuthToken`` have been removed (deprecated since v0.6).
* Fixed a bug that caused some exceptions to be returned rather than raised.
* ``GraphAPI`` now supports retries for ``get``, ``post``, ``delete``, ``search`` and ``fql``.
* ``GraphAPI#get`` is now more intelligent about pagination and should no longer query Facebook for another page
of results if the current page has less elements than ``limit``.

Note: This release is backwards-incompatible.


* You may now access the original data of the signed request from ``SignedRequest#raw``.
* You may now issue FQL queries with ``GraphAPI#fql``.
* Fixed a bug that caused ``GraphAPI#batch`` to crash upon receiving legacy errors from Facebook.
* ``FacebookError`` exceptions yielded from ``GraphAPI#batch`` now include the request that
produced the error.


* Facepy will now raise ``OAuthError`` for authorization-related errors.
* Facepy will now reuse the connection to Facebook.


* Fixed a bug that caused a KeyError upon parsing errors without an error code.


* Fixed a bug that caused some errors to be ignored.
* Facepy now raises ``GraphAPI.HTTPError`` for requests whose transport failed,
and ``GraphAPI.FacebookError`` for requests that produced an error in Facebook's API.
* Fixed a bug that caused an error for empty batch responses.


* Facepy now supports batch requests.


* Updated requests.


* Fixed a bug that caused SignedRequest.User#has_authorized_application to be incorrect for
signed requests with an user id, but no OAuth Token.
* Fixed a bug that caused queries that returned 3xx status codes to yield a blank string


* Fixed a bug that caused installation to fail in some circumstances.


* Fixed a bug that caused a KeyError upon parsing a signed request that didn't include the user's age.


* Fixed a bug that caused a NameError upon providing a list of strings as a Graph API parameter.


* Search results may now be paged.
* 'facepy.VERSION' is now 'facepy.__version__'


* It is now considerably easier to create signed requests programmatically.


* Facepy now returns the complete API response instead of just its "data" attribute.

Note: This release is backwards-incompatible.


* Facepy is now compatible with Python 2.4.
* Fixed a bug that caused a KeyError if the user's locale or country is missing from the signed request.


* Fixed a bug that caused a TypeError upon parsing signed requests in unicode.


* Added support for parsing and reverse-engineering signed requests.
* Added support for file-like objects in POST and PUT.


* Fixed a bug that prevented the 'page' argument to GraphAPI#get from working


* GraphAPI#get now has a new argument 'page', which returns a generator
that iterates over each page of results.


* The GraphAPI class may now be initialized by signed request.


* Fix a bug that caused non-JSON data (e.g. pictures) to raise a ValueError.


* Fix a bug that caused a TypeError if the 'path' argument is an integer.


* Exceptions have been moved.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facepy-pozytywnie-1.0.4.tar.gz (13.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page