[Python-modules-commits] [python-pypump] 01/01: Import python-pypump_0.7.orig.tar.gz
Wolfgang Borgert
debacle at moszumanska.debian.org
Fri Oct 14 21:46:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch upstream
in repository python-pypump.
commit 300fd1ed25376e63b5564294a1d5847a32d2d0a8
Author: W. Martin Borgert <debacle at debian.org>
Date: Fri Oct 14 21:37:17 2016 +0000
Import python-pypump_0.7.orig.tar.gz
---
.coveragerc | 2 +
.travis.yml | 8 +-
AUTHORS.md => AUTHORS.rst | 0
CHANGELOG.md | 18 --
CHANGELOG.rst | 31 ++++
README.rst | 16 +-
docs/changelog.rst | 4 +
docs/classref.rst | 30 +++-
docs/common/media.rst | 3 +-
docs/conf.py | 4 +-
docs/examples/pypump-post-note.py | 29 +--
docs/gettingstarted/authentication.rst | 20 +--
docs/gettingstarted/installing.rst | 1 -
docs/gettingstarted/qnd.rst | 14 +-
docs/gettingstarted/tutorial.rst | 70 ++------
docs/gettingstarted/verifier_callback.rst | 31 ++--
docs/gettingstarted/webpump.rst | 4 +
docs/index.rst | 27 ++-
docs/store.rst | 3 +-
pypump/client.py | 11 +-
pypump/exception/DoesNotExist.py | 20 ---
pypump/exception/ImmutableException.py | 25 ---
pypump/exception/PumpException.py | 21 ---
pypump/exception/ServerError.py | 25 ---
pypump/exception/__init__.py | 25 ---
.../{exception/StoreException.py => exceptions.py} | 18 ++
pypump/models/__init__.py | 60 ++++++-
pypump/models/collection.py | 3 +-
pypump/models/feed.py | 164 +++++++++++++----
pypump/models/{image.py => media.py} | 195 +++++++++++----------
pypump/models/note.py | 2 +-
pypump/models/person.py | 6 +-
pypump/models/place.py | 17 ++
pypump/pypump.py | 53 +++---
pypump/store.py | 6 +-
setup.py | 80 ++++-----
tests/__init__.py | 16 +-
tests/activity_test.py | 98 ++++++-----
tests/client_test.py | 4 +-
tests/collection_test.py | 34 ++--
tests/comment_test.py | 24 ++-
tests/feed_test.py | 139 ++++++++++++---
tests/image_test.py | 52 ++++--
tests/mapper_test.py | 32 ++--
tests/note_test.py | 40 +++--
tests/person_test.py | 36 ++--
tests/place_test.py | 20 ++-
tests/postable_test.py | 13 +-
tests/pumpobject_test.py | 4 +-
tests/pypump_test.py | 48 +++++
tests/store_test.py | 23 ++-
tests/webpump_test.py | 4 +-
tox.ini | 4 +
53 files changed, 977 insertions(+), 660 deletions(-)
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..06240de
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,2 @@
+[run]
+source = pypump
diff --git a/.travis.yml b/.travis.yml
index ba44fbd..86569c0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,10 @@
---
language: python
python:
- - "2.6"
- "2.7"
- "3.3"
- "3.4"
+ - "3.5"
- "pypy"
matrix:
@@ -16,11 +16,15 @@ matrix:
install:
- python setup.py develop
+ - pip install -q coverage codecov
script:
- - python setup.py test
+ - coverage run --branch setup.py test
+
+after_success: codecov
notifications:
irc:
channels:
- "ircs://irc.megworld.co.uk:9000#pypump"
+sudo: false
diff --git a/AUTHORS.md b/AUTHORS.rst
similarity index 100%
rename from AUTHORS.md
rename to AUTHORS.rst
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 42d16e6..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,18 +0,0 @@
-0.6
-===
-- Person no longer accept a webfinger without a hostname
-- PumpObject.add_link and .add_links renamed to ._add_link and ._add_links
-- Recipients can now be set for Comment, Person objects
-- Recipient properties (.to, .cc, .bto, .bcc) has been moved from Activity to Activity.obj
-- Feeds (inbox, followers, etc) can now be sliced by object or object_id.
-- Feed.items(offset=int|since=id|before=id, limit=20) method.
-- Unicode improvements when printing Pump objects.
-- Instead of skipping an Object attribute which has no response data (f.ex Note.deleted when note has not been deleted) we now set the attribute to None.
-- Fixed WebPump OAuth token issue (#89)
-- Allow you to use \<commentable object\>.comment() by passing in just a string apposed to a Comment object. ([44f3426](https://github.com/xray7224/PyPump/commit/44f34268a4d0f97107438baf05510b75f9fdebee))
-- Introduce "Store" object for saving persistant data.
-
-Earlier Releases
-================
-
-Sorry we didn't keep a change log prior to 0.6, you'll have to fish through the git commits to see what's changed.
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
new file mode 100644
index 0000000..382f7d9
--- /dev/null
+++ b/CHANGELOG.rst
@@ -0,0 +1,31 @@
+0.7
+===
+- Fixed bug where Image.original never got any info `#145 <https://github.com/xray7224/PyPump/issues/145>`_
+- Added Audio and Video objects
+- Work around bug in pump.io favorites feed which only let us get 20 latest items `#65 <https://github.com/xray7224/PyPump/issues/65>`_
+- Person.update() now updates Person.location
+- Fixed bug where PyPump with Python3 failed to save credentials to theJSONStore
+- Dropped Python 2.6 support, PyPump now supports Python 2.7 or 3.3+
+- PyPump now tries HTTPS first, and then only falls back to HTTP if ``verify_requests`` is ``False``
+- Fixed bug where ``PyPump.request()`` didnt sign oauth request on redirect `#120 <https://github.com/xray7224/PyPump/issues/120>`_
+- Implement list methods on ItemList and Feed (``__getitem__`` and ``__len__``)
+- Moved exceptions into single module and removed some unused exceptions. Make sure to update your import statements!
+
+0.6
+===
+- Person no longer accept a webfinger without a hostname
+- PumpObject.add_link and .add_links renamed to ._add_link and ._add_links
+- Recipients can now be set for Comment, Person objects
+- Recipient properties (.to, .cc, .bto, .bcc) has been moved from Activity to Activity.obj
+- Feeds (inbox, followers, etc) can now be sliced by object or object_id.
+- ``Feed.items(offset=int|since=id|before=id, limit=20)`` method.
+- Unicode improvements when printing Pump objects.
+- Instead of skipping an Object attribute which has no response data (f.ex Note.deleted when note has not been deleted) we now set the attribute to None.
+- Fixed WebPump OAuth token issue (`#89 <https://github.com/xray7224/PyPump/issues/89>`_)
+- Allow you to use ``<commentable object\>.comment()`` by passing in just a string apposed to a Comment object. `44f3426 <https://github.com/xray7224/PyPump/commit/44f34268a4d0f97107438baf05510b75f9fdebee>`_
+- Introduce "Store" object for saving persistant data.
+
+Earlier Releases
+================
+
+Sorry we didn't keep a change log prior to 0.6, you'll have to fish through the git commits to see what's changed.
diff --git a/README.rst b/README.rst
index eaf8cea..2d0c645 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,9 @@
+.. image:: https://travis-ci.org/xray7224/PyPump.svg?branch=master
+ :target: https://travis-ci.org/xray7224/PyPump
+
+.. image:: https://codecov.io/github/xray7224/PyPump/coverage.svg?branch=master
+ :target: https://codecov.io/github/xray7224/PyPump
+
================================
PyPump - Python Pump.io Library
================================
@@ -19,9 +25,9 @@ What does PyPump require?
PyPump works with:
-- Python (2.6, 2.7, 3.3+)
+- Python (2.7, 3.3+)
- requests-oauthlib 0.3.0+
-- requests 1.2.0+
+- requests 2.3.0+
*We provide a unified version which works with both the python 2 and python 3 versions.*
@@ -39,12 +45,6 @@ You can install it via pip::
$ pip install pypump
-If you're using Python 2, you may wish to install the following packages for SNI support::
-
- $ pip install ndg-httpsclient pyopenssl pyasn1
-
-These packages are not automatually installed due to pyopenssl being a C extension.
-
Chat with us?
=============
diff --git a/docs/changelog.rst b/docs/changelog.rst
new file mode 100644
index 0000000..6c760b6
--- /dev/null
+++ b/docs/changelog.rst
@@ -0,0 +1,4 @@
+Changelog
+---------
+
+.. include:: ../CHANGELOG.rst
diff --git a/docs/classref.rst b/docs/classref.rst
index 7673213..1db1111 100644
--- a/docs/classref.rst
+++ b/docs/classref.rst
@@ -14,7 +14,9 @@ Pump objects
Classes representing pump.io objects:
* :class:`Note <pypump.models.note.Note>`
- * :class:`Image <pypump.models.image.Image>`
+ * :class:`Image <pypump.models.media.Image>`
+ * :class:`Audio <pypump.models.media.Audio>`
+ * :class:`Video <pypump.models.media.Video>`
* :class:`Comment <pypump.models.comment.Comment>`
* :class:`Person <pypump.models.person.Person>`
* :class:`Inbox <pypump.models.feed.Inbox>`
@@ -26,19 +28,36 @@ Classes representing pump.io objects:
:exclude-members: serialize
:inherited-members:
-.. autoclass:: pypump.models.image.Image
+.. autoclass:: pypump.models.media.Image
:inherited-members:
.. attribute:: thumbnail
- :class:`ImageContainer <pypump.models.image.ImageContainer>`
+ :class:`ImageContainer <pypump.models.media.ImageContainer>`
holding information about the thumbnail image.
.. attribute:: original
- :class:`ImageContainer <pypump.models.image.ImageContainer>`
+ :class:`ImageContainer <pypump.models.media.ImageContainer>`
holding information about the original image.
+.. autoclass:: pypump.models.media.Audio
+ :inherited-members:
+
+ .. attribute:: stream
+
+ :class:`StreamContainer <pypump.models.media.StreamContainer>`
+ holding information about the stream.
+
+.. autoclass:: pypump.models.media.Video
+ :inherited-members:
+
+ .. attribute:: stream
+
+ :class:`StreamContainer <pypump.models.media.StreamContainer>`
+ holding information about the stream.
+
+
.. autoclass:: pypump.models.comment.Comment
:inherited-members:
@@ -57,7 +76,8 @@ Low level objects
Classes you probably don't need to know about.
-.. autoclass:: pypump.models.image.ImageContainer
+.. autoclass:: pypump.models.media.ImageContainer
+.. autoclass:: pypump.models.media.StreamContainer
.. .. autoclass:: pypump.models.PumpObject
.. .. autoclass:: pypump.models.Mapper
diff --git a/docs/common/media.rst b/docs/common/media.rst
index e95a4d1..07b8532 100644
--- a/docs/common/media.rst
+++ b/docs/common/media.rst
@@ -1,4 +1,3 @@
-============
Upload Media
============
@@ -45,4 +44,4 @@ Deleting media is also easy::
>> my_image.delete()
-.. note:: MediaGoblin current doesn't support deletion of media.
\ No newline at end of file
+.. note:: MediaGoblin current doesn't support deletion of media.
diff --git a/docs/conf.py b/docs/conf.py
index abcb44a..688765d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -36,8 +36,8 @@ templates_path = ['_templates']
source_suffix = '.rst'
# Versions/Release
-version = "0.6"
-release = "0.6-dev"
+version = "0.7"
+release = "0.7"
# The encoding of source files.
#source_encoding = 'utf-8-sig'
diff --git a/docs/examples/pypump-post-note.py b/docs/examples/pypump-post-note.py
index d70f4a0..abf446b 100755
--- a/docs/examples/pypump-post-note.py
+++ b/docs/examples/pypump-post-note.py
@@ -16,18 +16,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##
-import os
-import json
import argparse
+import json
+import os
from pypump import PyPump, Client
-class App(object):
+class App(object):
client_name = 'pypump-post-note'
pump = None
- config_file = os.path.join(os.environ['HOME'],'.config',
- client_name, 'config.json')
+ config_file = os.path.join(os.environ['HOME'],'.config', client_name, 'config.json')
config = dict()
def __init__(self):
@@ -47,27 +46,27 @@ class App(object):
# have to authorize the app with our account.
webfinger = self.args.webfinger
- client=Client(
+ client = Client(
webfinger=webfinger,
type='native',
name=self.client_name,
key=self.config.get(webfinger, {}).get('key'),
- secret=self.config.get(webfinger, {}).get('secret')
+ secret=self.config.get(webfinger, {}).get('secret'),
)
self.pump = PyPump(
client=client,
token=self.config.get(webfinger, {}).get('token'),
secret=self.config.get(webfinger, {}).get('token_secret'),
- verifier_callback=self.verifier
+ verifier_callback=self.verifier,
)
# Add account credentials to config in case we didnt have it already
self.config[webfinger] = {
- 'key' : self.pump.get_registration()[0],
- 'secret' : self.pump.get_registration()[1],
- 'token' : self.pump.get_token()[0],
- 'token_secret' : self.pump.get_token()[1],
+ 'key': self.pump.get_registration()[0],
+ 'secret': self.pump.get_registration()[1],
+ 'token': self.pump.get_token()[0],
+ 'token_secret': self.pump.get_token()[1],
}
self.write_config()
@@ -89,7 +88,7 @@ class App(object):
with open(self.config_file, 'w') as f:
f.write(json.dumps(self.config))
f.close()
-
+
def read_config(self):
""" Read config from file """
try:
@@ -106,14 +105,16 @@ class App(object):
note_title = self.args.note_title
else:
note_title = None
+
note_content = self.args.note_content
- mynote = self.pump.Note(display_name=note_title, content = note_content)
+ mynote = self.pump.Note(display_name=note_title, content=note_content)
mynote.to = self.pump.me.followers
mynote.cc = self.pump.Public
mynote.send()
return mynote.id or None
+
if __name__ == '__main__':
app = App()
url = app.post_note()
diff --git a/docs/gettingstarted/authentication.rst b/docs/gettingstarted/authentication.rst
index e958180..7d65631 100644
--- a/docs/gettingstarted/authentication.rst
+++ b/docs/gettingstarted/authentication.rst
@@ -1,30 +1,30 @@
-=============
Authorization
=============
What you need to know
---------------------
-Pump.io uses OAuth 1.0 with dynamic client registration, this available through a lot of libraries, PyPump uses `oauthlib <https://github.com/idan/oauthlib>`_ and a wrapper around it to provide an provide an interface with the `requests <http://docs.python-requests.org/en/latest/>`_ library - `requests-oauthlib <https://github.com/requests/requests-oauthlib>`. All of that is handled by PyPump however there are some things to know.
+Pump.io uses OAuth 1.0 with dynamic client registration, this is available through a lot of libraries, PyPump uses `oauthlib <https://github.com/idan/oauthlib>`_ and a wrapper around it to provide an provide an interface with the `requests <http://docs.python-requests.org/en/latest/>`_ library - `requests-oauthlib <https://github.com/requests/requests-oauthlib>`. All of that is handled by PyPump however there are some things to know.
+
+OAuth works by exchanging pre-established client credentials and tokens, you however have to provide those each time you instantiate the PyPump object. You will have to provide a mechanism to store these so that you can you can provide them the next time.
-OAuth works by exchanging pre-established client credentials and token, you however have to provide those each time you make instantiate the PyPump object. You will have to provide a mechanism to store these so that you can you can provide them the next time.
+.. note::
+ As of version 0.6 PyPump is storing credentials using an internal :doc:`../store` object.
Example
-------
The following will create (for the first time) a connection to a pump.io server for the user Tsyesika at io.theperplexingpariah.co.uk for my client named "Test.io"::
>>> from pypump import PyPump, Client
- >>> from pypump.utils import simple_verifier
>>> client = Client(
... webfinger="Tsyesika at io.theperplexingpariah.co.uk",
... name="Test.io",
... type="native"
...)
+ >>> def simple_verifier(url):
+ ... print('Go to: ' + url)
+ ... return raw_input('Verifier: ') # they will get a code back
>>> pump = PyPump(client=client, verifier_callback=simple_verifier)
- >>> client_credentials = pump.get_registration() # will return [<client key>, <client secret>, <expiry>]
- >>> client_tokens = pump.get_token() # will return [<token>, <secret>]
-
-.. note:: If you're not using CLI you will need to override the *get_access* method on PyPump to ask for their verification token
An example of then connecting again (using the same variable names as above). This will produce a PyPump object which will use the same credentials as established above::
@@ -32,12 +32,8 @@ An example of then connecting again (using the same variable names as above). Th
... webfinger="Tsyesika at io.theperplexingpariah.co.uk",
... name="Test.io",
... type="native",
- ... key=client_credentials[0], # client key
- ... secret=client_credentials[1] # client secret
... )
>>> pump = PyPump(
... client=client,
- ... token=client_tokens[0], # the token key
- ... secret=client_tokens[1], # the token secret
... verifier_callback=simple_verifier
... )
diff --git a/docs/gettingstarted/installing.rst b/docs/gettingstarted/installing.rst
index 420e1ee..aadd925 100644
--- a/docs/gettingstarted/installing.rst
+++ b/docs/gettingstarted/installing.rst
@@ -1,4 +1,3 @@
-=============
Installation
=============
diff --git a/docs/gettingstarted/qnd.rst b/docs/gettingstarted/qnd.rst
index cc460d3..5a12861 100644
--- a/docs/gettingstarted/qnd.rst
+++ b/docs/gettingstarted/qnd.rst
@@ -1,4 +1,3 @@
-===============
Quick 'n Dirty!
===============
@@ -18,16 +17,13 @@ So we need to get started::
As Part of our application we will need to ask the user to input a verification code
from the website to give us access as part of the OAuth mechanism, the function needs
-to take a URL and have the user allow our application this function can either return
-the verification code or you can call pump.verify(code), a simple code::
+to take a URL and have the user allow our application, for example::
>>> def simple_verifier(url):
- ... print 'Please follow the instructions at the following URL:'
- ... print url
+ ... print('Please follow the instructions at the following URL:')
+ ... print(url)
... return raw_input("Verifier: ") # the verifier is a string
-.. note:: If you wish to call pump.verify(<verification code>) return None from your verifier function
-
First we must tell the server about ourselves::
>>> client = Client(
@@ -85,7 +81,7 @@ I wonder what was posted last::
Oh it's an image, lets see the thumbnail::
>>> url = latest_activity.obj.thumbnail.url
- >>> fout = open("some_image.{0}".format(url.split(".")[-1], "wb")
+ >>> fout = open("some_image.{0}".format(url.split(".")[-1]), "wb")
>>> import urllib2 # this will be different with python3
>>> fout.write(urllib2.urlopen(url).read())
>>> fout.close()
@@ -97,7 +93,7 @@ Hmm, I want to see a bigger version::
<Image at https://some.server/uploads/somefriend/2013/7/7/JkdX2.png">
>>> # you will find Images often hold other pump.Image objects, we just need to extra the url
>>> large_url = large_url.url
- >>> fout = open("some_image_larger.{0}".format(large_url.split(".")[-1], "wb")
+ >>> fout = open("some_image_larger.{0}".format(large_url.split(".")[-1]), "wb")
>>> fout.write(urllib2.urlopen(url).read())
>>> fout.close()
diff --git a/docs/gettingstarted/tutorial.rst b/docs/gettingstarted/tutorial.rst
index c8879bc..68f9c2c 100644
--- a/docs/gettingstarted/tutorial.rst
+++ b/docs/gettingstarted/tutorial.rst
@@ -1,4 +1,3 @@
-========
Tutorial
========
@@ -57,36 +56,38 @@ your first time, you need to authenticate this client::
... name="Test.io"
... )
>>> def simple_verifier(url):
- ... print 'Go to: ' + url
+ ... print('Go to: ' + url)
... return raw_input('Verifier: ') # they will get a code back
>>> pump = PyPump(client=client, verifier_callback=simple_verifier)
-By default PyPump will use the JSONStore which comes with PyPump. This
-will store the client and OAuth credentials created when you connect
-to pump at ``~/$XDG_CONFIG_HOME/PyPump/credentials.json.`` If you wish
-to change the path or store the data somewhere else (postgres, mongo,
-redis, etc.) we suggest you read the :doc:`../store` documentation.
-
The PyPump call will try to verify with OAuth. You may wish to change how it
-asks for authentication. PyPump's ``simple_verifier`` by default writes to
+asks for authentication. The ``simple_verifier`` function in the example above writes to
standard out a URL for the user to click and reads in from standard in for a
verification code presented by the webserver.
-You should store the client credentials and tokens somewhere but ensure
-you store them somewhere safe with this information anyone can access the
-user's pump.io account! You can now reconnect like so::
+.. note::
+
+ By default PyPump will use the JSONStore which comes with PyPump.
+ This will store the client and OAuth credentials created when you
+ connect to pump at ``~/$XDG_CONFIG_HOME/PyPump/credentials.json.`` If
+ you wish to change the path or store the data somewhere else
+ (postgres, mongo, redis, etc.) we suggest you read the
+ :doc:`../store` documentation.
+
+ .. warning::
+
+ You should store the client credentials and tokens somewhere safe,
+ with this information anyone can access the user's pump.io account!
+
+You can now reconnect like so::
>>> client = Client(
... webfinger="mizbunny at example.org",
... type="native",
... name="Test.io",
- ... key=client_credentials[0],
- ... secret=client_credentials[1],
...)
>>> pump = PyPump(
... client=client,
- ... token=client_tokens[0], # the token
- ... secret=client_tokens[1], # the token secret
... verifier_callback=simple_verifier
...)
@@ -167,43 +168,6 @@ our outbox::
... content="I took this the other day, came out really well!")
>>> img.from_file("sunset.jpg")
-Want to see what the model actually looks like?
-All activities in pump.io have a .serialize method::
-
- >>> output = message.serialize(indent=4)
- >>> print(output)
- {
- "id": "http://coding.example/api/activity/bwkflwken",
- "actor": {
- "id": "acct:bwk at coding.example",
- "objectType": "person",
- "displayName": "Brian Kernighan"
- },
- "verb": "follow",
- "to": [
- {
- "id": "acct:ken at coding.example",
- "objectType": "person"
- }
- ],
- "object": {
- "id": "acct:ken at coding.example",
- "objectType": "person",
- "displayName": "Ken Thompson"
- },
- "published": "1974-01-01T00:00:00",
- "links": [
- {
- "rel": "self",
- "href": "http://coding.example/api/activity/bwkflwken"
- }
- ]
- }
-
-.. (Yes, that was stolen from the Pump API docs :))
-
-(similarly, all activity classes provide a unserialize class method).
-
When posting an image or a note you may wish to post it to
more people than just your followers (which is the default on most pump servers).
You can easily do this by doing::
diff --git a/docs/gettingstarted/verifier_callback.rst b/docs/gettingstarted/verifier_callback.rst
index eca2cc4..c7c0d51 100644
--- a/docs/gettingstarted/verifier_callback.rst
+++ b/docs/gettingstarted/verifier_callback.rst
@@ -1,16 +1,15 @@
-================
Getting Verifier
================
-As part of OAuth to allow OOB (Out of band) applications to have access to the account
-we have a link that they will click, follow the instructions and then copy the verifier
-into the application which we then relay to the server with other tokens. The server
-will them provide us with the credentials that we can use.
+For OAuth to allow OOB (Out of band) applications to have access to an account,
+first we must provide a link and instructions for the user. Then we must provide
+a means of copying the verifier into an application and relaying it to the server
+with other tokens. The server will then provide us with the credentials that we can use.
-You will need to write a method which takes a URL that the user needs to visit and provide
-some way of the users inputting string value which you will then give to PyPump. This could
-just be a case of printing the link and using raw_input/input to get the verifier or it could
-be a more complex funtion which redraws a GUI and opens a browser.
+You must write a method which takes a URL that the user needs to visit, provide some
+way for that user to input a string value (the verification), and then give that value to PyPump. This could
+be simply a case of printing the link and using raw_input/input to get the verifier or it could
+be a more complex function which redraws a GUI and opens a browser.
Simple verifier
@@ -22,16 +21,16 @@ verifier in the PyPump Shell::
def verifier(url):
""" Asks for verification code for OAuth OOB """
- print "Please open and follow the instructions:"
- print url
+ print("Please open and follow the instructions:")
+ print(url)
return raw_input("Verifier: ")
Callback
--------
-Having a function which is called and then returns back the verification might be more
-difficult in GUI programs or other interfaces. We provide a callback mechamism that you
-can use. If the verifier function returns None then PyPump assumes you will be be then
+Having a function which is called and then returns the verification might be more
+difficult in GUI programs or other interfaces. We provide a callback mechanism that you
+can use. If the verifier function returns None then PyPump assumes you will be
calling PyPump.verifier which takes the verifier as the argument.
Complex GUI example
@@ -52,7 +51,7 @@ one up in order to demonstrate exactly what might be involved::
self.draw("Please wait, loading...")
# setup pypump object
- clinet = Client(
+ client = Client(
webfinger='someone at server.com',
type='native',
name='An awesome GUI client'
@@ -83,4 +82,4 @@ one up in order to demonstrate exactly what might be involved::
If you return anything from your verifier callback, pypump will expect that to be
the verifier code so unless you're actually using a simple method, ensure you return
-None.
\ No newline at end of file
+None.
diff --git a/docs/gettingstarted/webpump.rst b/docs/gettingstarted/webpump.rst
index 05a3bb7..ed9f3de 100644
--- a/docs/gettingstarted/webpump.rst
+++ b/docs/gettingstarted/webpump.rst
@@ -1,6 +1,10 @@
Web Development using PyPump
============================
+.. warning::
+
+ This section needs to be updated.
+
One of the problem with PyPump and Web development is that you often have
a view which is called and then must return a function. While it is possible
it may be difficult to use the regular PyPump callback routines. WebPump is a
diff --git a/docs/index.rst b/docs/index.rst
index 7e20b93..23aa64e 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -6,6 +6,8 @@
PyPump - Python Pump.io Library
===============================
+Release v\ |release|.
+
PyPump is a simple but powerful and pythonic way of interfacing with the `pump.io <http://pump.io>`_ API.
PyPump is under the `GPLv3 <https://www.gnu.org/licenses/gpl.html>`_. You should probably
@@ -18,9 +20,8 @@ If you're new to PyPump and feeling a bit overwhelmed the :doc:`gettingstarted/t
place to go, however if you're familiar with python and understand pump, check out the
:doc:`gettingstarted/qnd` guide!
-Contents
---------
.. toctree::
+ :caption: User documentation
:maxdepth: 1
gettingstarted/installing
@@ -32,21 +33,29 @@ Contents
store
-Common
-------
+ common/media
+
.. toctree::
+ :caption: API documentation
:maxdepth: 1
- common/media
+ classref
-API
----
+About PyPump
+============
.. toctree::
- :maxdepth: 2
+ :maxdepth: 2
+ :caption: Version history
+
+ changelog
+
+Links
+-----
+* `PyPump on Github <https://github.com/xray7224/PyPump>`_
+* `PyPump on PyPI <https://pypi.python.org/pypi/pypump>`_
- classref
This was build on |today|
diff --git a/docs/store.rst b/docs/store.rst
index 302ad98..532b4f8 100644
--- a/docs/store.rst
+++ b/docs/store.rst
@@ -1,4 +1,3 @@
-======
Store
======
@@ -24,7 +23,7 @@ extra methods other than dictionary methods you need to implement
are::
@classmethod
- def load(cls, webfiger, pump):
+ def load(cls, webfinger, pump):
"""
This should return an instance of the store object full of any
data that has been saved. It's your responsibility to set the
diff --git a/pypump/client.py b/pypump/client.py
index 5c8bf64..2fe8d8b 100644
--- a/pypump/client.py
+++ b/pypump/client.py
@@ -22,16 +22,9 @@ import logging
import requests
-_log = logging.getLogger(__name__)
-
-
-class ClientException(Exception):
+from pypump.exceptions import ClientException
- def __init__(self, message, context=None, *args, **kwargs):
- if context is not None:
- message = "{0} (context: {1})".format(message, context)
-
- super(ClientException, self).__init__(message, *args, **kwargs)
+_log = logging.getLogger(__name__)
class Client(object):
diff --git a/pypump/exception/DoesNotExist.py b/pypump/exception/DoesNotExist.py
deleted file mode 100644
index 2b465d3..0000000
--- a/pypump/exception/DoesNotExist.py
+++ /dev/null
@@ -1,20 +0,0 @@
-##
-# Copyright (C) 2013 Jessica T. (Tsyesika) <xray7224 at googlemail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-##
-
-
-class DoesNotExist(Exception):
- pass
diff --git a/pypump/exception/ImmutableException.py b/pypump/exception/ImmutableException.py
deleted file mode 100644
index 65a642a..0000000
--- a/pypump/exception/ImmutableException.py
+++ /dev/null
@@ -1,25 +0,0 @@
-##
-# Copyright (C) 2013 Jessica T. (Tsyesika) <xray7224 at googlemail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-##
-
-
-class ImmutableException(Exception):
-
- message = "You can't set %s on %s, the object is immutable."
-
- def __init__(self, item, obj, *args, **kwargs):
- message = self.message % (item, obj)
- super(ImmutableException, self).__init__(message, *args, **kwargs)
diff --git a/pypump/exception/PumpException.py b/pypump/exception/PumpException.py
deleted file mode 100644
index 13cbd80..0000000
--- a/pypump/exception/PumpException.py
+++ /dev/null
@@ -1,21 +0,0 @@
-##
-# Copyright (C) 2013 Jessica T. (Tsyesika) <xray7224 at googlemail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-##
-
-
-class PumpException(Exception):
- """ This is used when the remote server gives an error """
- pass
diff --git a/pypump/exception/ServerError.py b/pypump/exception/ServerError.py
deleted file mode 100644
index fcc7c53..0000000
--- a/pypump/exception/ServerError.py
+++ /dev/null
@@ -1,25 +0,0 @@
-##
-# Copyright (C) 2013 Jessica T. (Tsyesika) <xray7224 at googlemail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-##
-
-import json
-
-
-class ServerError(Exception):
-
- def __init__(self, data, *args, **kwargs):
- data = json.loads(data)
- super(ServerError, self).__init__(data["error"], *args, **kwargs)
diff --git a/pypump/exception/__init__.py b/pypump/exception/__init__.py
deleted file mode 100644
index 2c38fbf..0000000
--- a/pypump/exception/__init__.py
+++ /dev/null
@@ -1,25 +0,0 @@
-##
-# Copyright (C) 2013 Jessica T. (Tsyesika) <xray7224 at googlemail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-##
-from __future__ import absolute_import
-
-from pypump.exception.StoreException import StoreException, ValidationError
-
-__all__ = ["StoreException", "ValidationError", "PyPumpException"]
-
-
-class PyPumpException(Exception):
- pass
diff --git a/pypump/exception/StoreException.py b/pypump/exceptions.py
similarity index 68%
rename from pypump/exception/StoreException.py
rename to pypump/exceptions.py
index 2c79027..51f372f 100644
--- a/pypump/exception/StoreException.py
+++ b/pypump/exceptions.py
@@ -16,6 +16,24 @@
##
+class PyPumpException(Exception):
+ pass
+
+
+class PumpException(Exception):
+ """ This is used when the remote server gives an error """
+ pass
+
+
+class ClientException(Exception):
+
+ def __init__(self, message, context=None, *args, **kwargs):
+ if context is not None:
+ message = "{0} (context: {1})".format(message, context)
+
+ super(ClientException, self).__init__(message, *args, **kwargs)
+
+
class StoreException(Exception):
""" Raised when error occurs in store """
pass
diff --git a/pypump/models/__init__.py b/pypump/models/__init__.py
index 3c724b2..994387a 100644
--- a/pypump/models/__init__.py
+++ b/pypump/models/__init__.py
@@ -18,10 +18,12 @@
import logging
import re
import six
+import os
+import mimetypes
from dateutil.parser import parse
-from pypump.exception.PumpException import PumpException
+from pypump.exceptions import PumpException
_log = logging.getLogger(__name__)
... 2357 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pypump.git
More information about the Python-modules-commits
mailing list