Has anybody had any recent success with accessing the Crowd SOAP API via the Suds Python library?
I've found a few people successfully doing it in the past but Atlassian seems to have changed their WSDL since then to make the existing advice not entirely helpful.
Below is the simplest example I've been trying:
from suds.client import Client
url = 'https://crowd.hugeinc.com/services/SecurityServer?wsdl'
client = Client(url)
Unfortunately that generates the following error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/soconnor/.virtualenvs/hugeface/lib/python2.6/site-packages/suds/client.py", line 116, in __init__
sd = ServiceDefinition(self.wsdl, s)
File "/Users/soconnor/.virtualenvs/hugeface/lib/python2.6/site-packages/suds/servicedefinition.py", line 58, in __init__
self.paramtypes()
File "/Users/soconnor/.virtualenvs/hugeface/lib/python2.6/site-packages/suds/servicedefinition.py", line 137, in paramtypes
item = (pd[1], pd[1].resolve())
File "/Users/soconnor/.virtualenvs/hugeface/lib/python2.6/site-packages/suds/xsd/sxbasic.py", line 63, in resolve
raise TypeNotFound(qref)
TypeNotFound: Type not found: '(AuthenticatedToken, http://authentication.integration.crowd.atlassian.com, )'
I've tried to both binding and doctors to fix this problem to no avail. Neither approach resulted in any change. Any further recommendations or suggestions would be incredibly helpful.
There is a patch for the Crowd WSDL here:
http://jira.atlassian.com/browse/CWD-159
Related
I m using pvporcupine python SDK for picovoice for hot word detection, while using the below code I'm getting runtime error
import pvporcupine
access_key = "[my_acces_key]" # AccessKey obtained from Picovoice Console (https://picovoice.ai/console/)
#access key is altered for security reason
handle = pvporcupine.create(access_key=access_key, keywords=['porcupine'])
here is the error stack trace
Traceback (most recent call last):
File "c:/Users/Pjan/saa2/actions/pic_again.py", line 5, in <module>
handle = pvporcupine.create(access_key=access_key, keywords=['porcupine'])
File "C:\Users\Pjan\.conda\envs\sam_env\lib\site-packages\pvporcupine\__init__.py", line 82, in create
sensitivities=sensitivities)
File "C:\Users\Pjan\.conda\envs\sam_env\lib\site-packages\pvporcupine\porcupine.py", line 158, in __init__
raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
pvporcupine.porcupine.PorcupineRuntimeError
here is the official site for picovoice SDK for python
any help is highly appreciated!
Well I contacted the official repository of picovoice and here I mentioned them what clearly was going on.
So anyone still facing it , then here is the solution for such behaviour https://github.com/Picovoice/porcupine/issues/617
Thanks!
so I have something very simple to ask but I can't get my head around it. I'm trying to import some stock data from yahoo finance, nothing fancy. I used to do this via:
import pandas.io.data as web
import pandas as pd
import datetime
start=datetime.datetime(2000,1,1)
end=datetime.date.today()
SLB=web.DataReader("SLB","yahoo",start,end)
Everything used to work lovely like this. However, I'm well aware of the changes that have taken place. The import method is now:
from pandas_datareader import data,wb
However, using this method, (and I'm still using the same start,end data etc), I receive:
SLB=wb.DataReader("SLB","yahoo",start,end)
Traceback (most recent call last):
File "<ipython-input-218-6633f366e2cb>", line 1, in <module>
SLB=wb.DataReader("SLB","yahoo",start,end)
AttributeError: module 'pandas_datareader.wb' has no attribute
'DataReader'
I've had a look online (obviously) for more information, and I've seen in some cases people have put:
SLB=data.DataReader('SLB','yahoo',start,end)
which leads to an even longer error altogether regarding issues connecting to the URL.
If anyone has come across this before, or can see errors in my code, It would be great if you could shed some light!
cheers
p.s.
the longer error message I got using:
SLB=data.DataReader("SLB","yahoo",start,end)
is:
SLB=data.DataReader("SLB","yahoo",start,end)
Traceback (most recent call last):
File "<ipython-input-226-0cd57c0d4cbe>", line 1, in <module>
SLB=data.DataReader("SLB","yahoo",start,end)
File "C:\Users\User\Anaconda3\lib\site-
packages\pandas_datareader\data.py", line 116, in DataReader
retry_count=retry_count, pause=pause,
File "C:\Users\User\Anaconda3\lib\site-
packages\pandas_datareader\yahoo\daily.py", line 76, in read
""" read one data from specified URL """
File "C:\Users\User\Anaconda3\lib\site-
packages\pandas_datareader\base.py", line 155, in read
if isinstance(self.symbols, (compat.string_types, int)):
File "C:\Users\User\Anaconda3\lib\site-
packages\pandas_datareader\base.py", line 74, in _read_one_data
out = self._read_url_as_StringIO(url, params=params)
File "C:\Users\User\Anaconda3\lib\site-
packages\pandas_datareader\base.py", line 85, in _read_url_as_StringIO
response = self._get_response(url, params=params)
File "C:\Users\User\Anaconda3\lib\site-
packages\pandas_datareader\base.py", line 120, in _get_response
raise RemoteDataError('Unable to read URL: {0}'.format(url))
RemoteDataError: Unable to read URL:
http://ichart.finance.yahoo.com/table.csv?
s=SLB&a=0&b=1&c=2000&d=5&e=16&f=2017&g=d&ignore=.csv
Hope this helps a little bit more.
I am able to use Sphinx to auto generate my project's API documentation locally, but I run into trouble when I try to use ReadTheDocs. When ReadTheDocs builds the documentation, the API pages are all blank (see this, for example). After I read this blog entry, I realized the solution is to mock things like numpy and matplotlib. So I added the following line to my conf.py
autodoc_mock_imports = ['numpy', 'matplotlib', 'matplotlib.pyplot', 'matplotlib.patches', 'matplotlib.path', 'matplotlib.lines', 'matplotlib.text', 'matplotlib.transforms', 'matplotlib.artist', 'cpickle']
With that addition, I cannot build the API documentation locally or on ReadTheDocs, because of the following two Sphinx issues.
Issue #1:
When I build the documentation I get the following error.
/Users/Ben/Documents/Python/clearplot/doc/source/api/clearplot.rst:19: WARNING: autodoc: failed to import module u'clearplot'; the following exception was raised:
Traceback (most recent call last):
File "/Users/Ben/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 385, in import_object
__import__(self.modname)
File "/Users/Ben/Documents/Python/clearplot/clearplot/__init__.py", line 33, in <module>
mpl_version = _parse_version_string(_mpl.__version__)
File "/Users/Ben/Documents/Python/clearplot/clearplot/__init__.py", line 19, in _parse_version_string
v_list = v.split(".")
AttributeError: type object '__version__' has no attribute 'split'
I have confirmed that this error comes from simply doing matplotlib.__version__.split("."). I couldn't figure out how to solve this issue quickly so I commented it out.
Issue #2:
Now, I get the following error when I build the documentation.
/Users/Ben/Documents/Python/clearplot/doc/source/api/clearplot.rst:19: WARNING: autodoc: failed to import module u'clearplot'; the following exception was raised:
Traceback (most recent call last):
File "/Users/Ben/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 385, in import_object
__import__(self.modname)
File "/Users/Ben/Documents/Python/clearplot/clearplot/__init__.py", line 45, in <module>
import params
File "/Users/Ben/Documents/Python/clearplot/clearplot/params.py", line 19, in <module>
_mpl.rcParams['backend'] = 'Qt4Agg'
TypeError: '_MockModule' object does not support item assignment
If I comment out the offending line (_mpl.rcParams['backend'] = 'Qt4Agg'), I get the same error for the next line because my params module is full of assignments to the matplotlib.rcParams dictionary.
Both of these issues look like a pain to fix. Is there a better way? If not, how should I solve Issue #1 and #2?
From reading this it looks like there is a work around for using dictionaries with mock. Should I search for a similar solution for using something as basic as the string that comes from matplotlib.__version__?
In case it helps, the code on github is here.
I'm testing ebaysdk Python library that lets you connect to ebay. Now I'm trying examples from: https://github.com/timotheus/ebaysdk-python/
So far I got stuck at this example:
from ebaysdk.shopping import Connection as Shopping
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file="ebay.yaml")
response = shopping.execute('FindPopularItems',
{'QueryKeywords': 'Python'})
print response.disct()
When I run it. It gives me this error:
Traceback (most recent call last):
File "ebay-test.py", line 13, in <module>
{'QueryKeywords': 'Python'})
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 123, in execute
self.error_check()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 193, in error_check
estr = self.error()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 305, in error
error_array.extend(self._get_resp_body_errors())
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/shopping/__init__.py", line 188, in _get_resp_body_errors
dom = self.response.dom()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 229, in dom
return self._dom
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 216, in __getattr__
return getattr(self._obj, name)
AttributeError: 'Response' object has no attribute '_dom'
Am I missing something here or it could be some kind of bug in library?
Do you have a config file? I had a lot of problems getting started with this SDK. To get the yaml config file to work, I had to specify the directory that it was in. So in your example, it would be:
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ebay.yaml'))
You should also be able to specify debug=true in your Shopping() declaration as in Shopping(debug=True).
Make sure if you have not, to specify your APP_ID and other necessary values in the config file.
You have the wrong domain, it should be open.api.sandbox.ebay.com. See this page on the ebaysdk github.
I'm getting the error:
Exception: imported schema (http://www.w3.org/2001/XMLSchema) at
(http://www.w3.org/2001/XMLSchema.x sd), failed
when passing a Doctor (constructed with ImportDoctor) to the suds Client constructor.
I'm working on two Windows machines, both of them got the same version of suds installed, but only one of them rises the error above.
Could someone guide me here to know why this error rises?, so I can figure out what's missing on the machine where it happens?.
Thanks in advance!!!.
UPDATE: I don't really know if this is important, but it's worth noting that my Windows machine that is rising the error is an Amazon Web Services instance. At my local machine everything's working well!.
UPDATE: Here's some code I ran at the python interpreter of the machine I mentioned. Here you can detail how the error is rising...
>>> from suds.client import Client
>>> from suds.xsd.doctor import ImportDoctor, Import
>>> missing_import = Import("http://www.w3.org/2001/XMLSchema")
>>> missing_import.filter.add("http://tempuri.org/")
>>> doctor = ImportDoctor(missing_import)
>>> client = Client("http://etcfulfill.ebooks.com/Fulfillment.asmx?wsdl")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "suds\client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "suds\reader.py", line 152, in open
d = self.fn(url, self.options)
File "suds\wsdl.py", line 159, in __init__
self.build_schema()
File "suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "suds\xsd\schema.py", line 95, in load
child.dereference()
File "suds\xsd\schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "suds\xsd\sxbasic.py", line 422, in dependencies
raise TypeNotFound(self.ref)
suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'
>>> client = Client("http://etcfulfill.ebooks.com/Fulfillment.asmx?wsdl", doctor=doctor)
No handlers could be found for logger "suds.xsd.sxbasic"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "suds\client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "suds\reader.py", line 152, in open
d = self.fn(url, self.options)
File "suds\wsdl.py", line 159, in __init__
self.build_schema()
File "suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "suds\xsd\schema.py", line 93, in load
child.open_imports(options)
File "suds\xsd\schema.py", line 305, in open_imports
imported = imp.open(options)
File "suds\xsd\sxbasic.py", line 542, in open
result = self.download(options)
File "suds\xsd\sxbasic.py", line 567, in download
raise Exception(msg)
Exception: imported schema (http://www.w3.org/2001/XMLSchema) at (http://www.w3.org/2001/XMLSchema.xsd), failed
UPDATE:
I realized that suds connections always open in TCP increasing ports, and if it reaches the maximum TCP port (65535) then it starts opening again from the minimum TCP port available, so there's no problem with this.
The problem shows up when using suds ImportDoctor, because it has to open a previous connection to the location where the import should be retrieved, and for some reason, if the system reaches the maximum TCP port count, then suds somehow assumes that there's no TCP port available to open the connection for obtaining the import, and in consecuence it throws the exception:
Exception: imported schema (http://www.w3.org/2001/XMLSchema) at (http://www.w3.org/2001/XMLSchema.xsd), failed
I repeat, this only happens if suds has to open this previous connection for obtaining the import. If ImportDoctor is not used, then suds has no problem if the TCP port count reaches its maximum, it just restarts at the minimum port available.
Does anyone has any clue on how to resolve this issue???. I'd really appreciate the help!!!.
I've figured out what the problem was. The schema that was missing from the WSDL I was trying to use with suds was:
http://www.w3.org/2001/XMLSchema
And the XSD file for this schema is at:
http://www.w3.org/2001/XMLSchema.xsd
So when I used suds ImportDoctor to add this schema import, sometimes the w3.org domain was denying my access (don't know why really) and that's why this error was rising:
Exception: imported schema (http://www.w3.org/2001/XMLSchema) at (http://www.w3.org/2001/XMLSchema.xsd), failed
What did I do to solve this problem?. I just downloaded this schema to my machine and used suds ImportDoctor to retrieve this import locally.
And that was it!!!. Confusing bug!!!. But SOLVED.