{ "info": { "author": "Christoph Glaubitz", "author_email": "chris@chrigl.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries" ], "description": "python-flattr\n=============\n\npython-flattr is a client library to the micro payment service flattr_. It\nimplements most aspects of the `flattr rest api`_. You may use it, to integrate\nflattr_-Support into your python program. For example creating things_ for new\nblog posts. Or you write some kind of podcatcher and want to automatically\nflattr (support) each downloaded episode.\n\nFeatures\n--------\n\n* create and update things\n* delete things\n* get things by id\n* search things\n* list things of a known user\n* list your things\n* list your subscriptions\n* subscribe to things\n* pause/resume subscriptions\n* flattr/support things\n\nInstallation\n------------\n\n.. code-block:: python\n\n pip install flattr\n\nUsage\n-----\n\nDISCLAIMER: The following code examples are python3. If you are using python2,\nyou have to pass unicodes especially to attributes of ``flattrclient.things.Thing``.\n\n\nFirst of all. You need to get an auth token. The implementation is up to you,\nwith only little help of python-flattr.\n\nWorkflow to get the auth token\n``````````````````````````````\n\nFollow the `authorization workflow`_. First of all, `register your app`_ in your\nuser profile on flattr, to get the *Client ID* and *Client Secret*.\n\nWith this credentials you can set up an api-connection\n\n.. code-block:: python\n\n >>> import flattrclient.oauth\n >>> auth_api = flattrclient.oauth.get()\n\nYou can call ``authorize`` to get the URL, you have to point your user to.\n\n.. code-block:: python\n\n >>> auth_api.authorize(CLIENT_ID, 'flattr,thing,email,extendedread', 'http://localhost:8080')\n 'https://flattr.com/oauth/authorize?scope=flattr%2Cthing%2Cemail%2Cextendedread&redirect_uri=http%3A%2F%2Flocalhost%3A8080&response_type=code&client_id=CLIENT_ID'\n\nHowever, you decide which scopes_ you need.\n\nYou may want to listen to ``localhost:8080`` or whatever callback you used.\nflattr_ will redirect the user to this URL, and send you (on success), a ``code``.\nPick this up and get the access token. This is also the only time, you need the\n*Client Secret*.\n\n.. code-block:: python\n\n >>> auth_api.set_auth(CLIENT_ID, CLIENT_SECRET)\n >>> auth_api.token(CODE, 'http://localhost:8080')\n 'XXXXX'\n\nThe entire process of getting the ``code`` an requesting the token should not\ntake too long. Anyway, it is still fast enough, if you copying the code from\nanother terminal window and call ``token`` in an interactive session.\n\nWorking with python-flattr\n``````````````````````````\n\nIn fact. The access token is the only thing you need to store somewhere.\n>From now on. You should be able to talk to the `flattr rest api`_. Give\nit a try and get all things of the user ``flattr``\n\n.. code-block:: python\n\n >>> import flattrclient.api\n >>> api = flattrclient.api.get(AUTH_TOKEN)\n >>> f = api.users('flattr')\n >>> f\n \n >>> things = list(f.get_things())\n [,\n ,\n ...]\n\nThat was fun. But what happened?\n\nFirst, we introduced the session between flattr_ and us, using ``flattrclient.api.get``.\nThis is very likely always the first thing, you do. Currently I use\n``requests.sessions.Session`` in the background, without any pooling.\n\nThen we create a lightweight ``flattrclient.user.User``-object. This does not perform\nany api-call. So if there is a typo, the next call (``get_things``), will cause\nthe error. If you want, to perform an api-call for the user, use\n``api.users.get('flattr')``.\n\nThe nect call to ``f.get_things()`` returns all things as a generator. So to make\nit more verbose here, we converted it into a list. All things? Not really. By\ndefault, the api only returns 30 results per page. But you can use ``count`` and\n``page`` to override this.\n\n.. code-block:: python\n\n >>> f.get_things(count=10, page=2)\n\nYou get page 2 of the results. Each page batched to 10 results.\n\n\nLet's step back to the ``api``. The api consits of a bunch of different other\napis, to which the ``request.session.Session`` object is passed.\n\n\n``api.things``: Talk to flattrs things api. ``get``, ``lookup`` and ``search`` for\nthings.\n\n``api.users``: Talk to flattrs user api. ``__call__`` and ``get``, described above.\n\n``api.authenticated``: Talk to flattrs authenticated api. Which means... list\nstuff of the authenticated user. ``get_activities``, ``get_flattrs``, ``get_things``\nand ``get_subscriptions``.\n\n\nHowever. You may want to create a new thing on flattr_.\n\n.. code-block:: python\n\n >>> mything = api.things.new(url='http://example.com', title='crazy title')\n >>> mything\n \n >>> mything.description = 'Some more context'\n >>> mything.commit()\n\nYou should use ``api.things.new`` to get a new object of ``flattrclient.things.Thing``\nbecause it again takes care of setting the session.\n\n\nSame if you want to update one of your things.\n\n.. code-block:: python\n\n >>> mythings = list(api.authenticated.get_things())\n >>> some_thing = mythings[0]\n >>> some_thing.title = 'Some new Title'\n >>> some_thing.commit()\n\nYou may not just create or update your own things_, but also flattr someones\nstuff. Each thing you got by user, or fetch via ``api.things`` is supportable.\n\n.. code-block:: python\n\n >>> thing = api.things.get('4085245')\n >>> thing\n \n >>> thing.support()\n {...}\n\nJust supporting is not enough? Subscribe to the thing\n\n.. code-block:: python\n\n >>> thing = api.things.get('4085245')\n >>> thing\n \n >>> thing.subscribe()\n {...}\n\nThere is also a ``unsubscribe`` and a ``pause_subscription``, which is a toggle\nto pause and resume this subscription.\n\n\nFeel free to use ``help`` on different stuff. Where it is much more useful to\nuse python3, since internaly some decorators are used, which results in\n``*args, **kwargs``-argument-lists in python2.\n\nIssues\n------\n\nYou are welcome to file issues or pull requests on github_.\n\nLicense\n-------\n\nApache License 2.0\n\n.. _flattr: https://flattr.com/\n.. _`flattr rest api`: http://developers.flattr.net/\n.. _`things`: http://developers.flattr.net/api/resources/things/\n.. _`authorization workflow`: http://developers.flattr.net/api/#authorization\n.. _`register your app`: http://flattr.com/apps/new\n.. _scopes: http://developers.flattr.net/api/#scopes\n.. _github: https://github.com/chrigl/python-flattr", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/chrigl/python-flattr", "keywords": "flattr", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "flattrclient", "package_url": "https://pypi.org/project/flattrclient/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/flattrclient/", "project_urls": { "Homepage": "https://github.com/chrigl/python-flattr" }, "release_url": "https://pypi.org/project/flattrclient/0.2/", "requires_dist": [ "six", "requests", "simplejson" ], "requires_python": null, "summary": "Implementation of a python library for the flattr restful api", "version": "0.2" }, "last_serial": 1510751, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f699c62a21da56cfef94b2e164c85796", "sha256": "010a9e76e773d10e6194ff3dc0e9b6da50518ff6c72ce674b98e7d63c3950660" }, "downloads": -1, "filename": "flattrclient-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f699c62a21da56cfef94b2e164c85796", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 31558, "upload_time": "2015-04-15T19:38:31", "url": "https://files.pythonhosted.org/packages/04/2f/942f8ac1b81478746a80f6bec9913c691d0d9420f97305c117084ad0ad45/flattrclient-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dc29a6434b5f96197f607cb714b24ff3", "sha256": "86bb2440d9ce0c4d1d2581f5fe8b27b91da22a541fa11459f3e2798dce079856" }, "downloads": -1, "filename": "flattrclient-0.1.tar.gz", "has_sig": false, "md5_digest": "dc29a6434b5f96197f607cb714b24ff3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20336, "upload_time": "2015-04-15T19:38:35", "url": "https://files.pythonhosted.org/packages/4f/98/c5ed6e6c8e3ffd452b069ce2072e2ced0358b88173e111001c77b46f8635/flattrclient-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "e35686ae8eb1c87d1712fb495f2e3f7b", "sha256": "5897554742f927aa1a03d4c83f208c988dae743cb76e103f4e9080dc10dc9241" }, "downloads": -1, "filename": "flattrclient-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e35686ae8eb1c87d1712fb495f2e3f7b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 31522, "upload_time": "2015-04-18T15:49:37", "url": "https://files.pythonhosted.org/packages/c1/fc/4e5cff7ee153d5badda51bf67e517078dbcac51ef3869da199b55dd37704/flattrclient-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a06519be24cb03492c222347bdf18a04", "sha256": "968b6a598a394f9a4f881cefd26824887d7dd617f5ce8a0a547107044ce46e3f" }, "downloads": -1, "filename": "flattrclient-0.2.tar.gz", "has_sig": false, "md5_digest": "a06519be24cb03492c222347bdf18a04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20313, "upload_time": "2015-04-18T15:49:40", "url": "https://files.pythonhosted.org/packages/d3/cc/2c7d4c6287c0a7480b71f0c5db13583eaf15ccc82d0703ce8acc428635de/flattrclient-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e35686ae8eb1c87d1712fb495f2e3f7b", "sha256": "5897554742f927aa1a03d4c83f208c988dae743cb76e103f4e9080dc10dc9241" }, "downloads": -1, "filename": "flattrclient-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e35686ae8eb1c87d1712fb495f2e3f7b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 31522, "upload_time": "2015-04-18T15:49:37", "url": "https://files.pythonhosted.org/packages/c1/fc/4e5cff7ee153d5badda51bf67e517078dbcac51ef3869da199b55dd37704/flattrclient-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a06519be24cb03492c222347bdf18a04", "sha256": "968b6a598a394f9a4f881cefd26824887d7dd617f5ce8a0a547107044ce46e3f" }, "downloads": -1, "filename": "flattrclient-0.2.tar.gz", "has_sig": false, "md5_digest": "a06519be24cb03492c222347bdf18a04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20313, "upload_time": "2015-04-18T15:49:40", "url": "https://files.pythonhosted.org/packages/d3/cc/2c7d4c6287c0a7480b71f0c5db13583eaf15ccc82d0703ce8acc428635de/flattrclient-0.2.tar.gz" } ] }