2018-03-27 09:36:52 |
Yushan Zhang |
description |
When running the copy-paste example from reference page:
````
from launchpadlib.launchpad import Launchpad
launchpad = Launchpad.login_with('hello-world', 'production')
print('Hello, %s!' % launchpad.me.display_name)
````
got an exception:
````
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/lazr/restfulclient/authorize/oauth.py", line 33, in <module>
oauth = __import__('oauth.oauth', {}).oauth
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/oauth/oauth.py", line 29, in <module>
import urlparse
ImportError: No module named 'urlparse'
````
This caused by the migration of this module to `from urllib.parse import urlparse`. After fixed this, got another exception for the second example:
````
from launchpadlib.launchpad import Launchpad
launchpad = Launchpad.login_anonymously('just testing', 'production')
````
````
sig = '%s&' % escape(consumer.secret)
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/oauth/oauth.py", line 50, in escape
return urllib.quote(s, safe='~')
AttributeError: module 'urllib' has no attribute 'quote'
````
This is caused by the same reason. And another:
````
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/lazr/restfulclient/authorize/oauth.py", line 248, in authorizeRequest
headers.update(oauth_request.to_header(self.oauth_realm))
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/oauth/oauth.py", line 207, in to_header
for k, v in self.parameters.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
````
If it is possible, I could do the fix found for Python 3.5 when exploring the APIs. |
When running the copy-paste example from reference page: (the package I use is installed with `pip install launchpadlib` which has a version of 1.10.6)
````
from launchpadlib.launchpad import Launchpad
launchpad = Launchpad.login_with('hello-world', 'production')
print('Hello, %s!' % launchpad.me.display_name)
````
got an exception:
````
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/lazr/restfulclient/authorize/oauth.py", line 33, in <module>
oauth = __import__('oauth.oauth', {}).oauth
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/oauth/oauth.py", line 29, in <module>
import urlparse
ImportError: No module named 'urlparse'
````
This caused by the migration of this module to `from urllib.parse import urlparse`. After fixed this, got another exception for the second example:
````
from launchpadlib.launchpad import Launchpad
launchpad = Launchpad.login_anonymously('just testing', 'production')
````
````
sig = '%s&' % escape(consumer.secret)
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/oauth/oauth.py", line 50, in escape
return urllib.quote(s, safe='~')
AttributeError: module 'urllib' has no attribute 'quote'
````
This is caused by the same reason. And another:
````
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/lazr/restfulclient/authorize/oauth.py", line 248, in authorizeRequest
headers.update(oauth_request.to_header(self.oauth_realm))
File "/home/zhangysh1995/.local/lib/python3.5/site-packages/oauth/oauth.py", line 207, in to_header
for k, v in self.parameters.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
````
If it is possible, I could do the fix found for Python 3.5 when exploring the APIs. |
|