Cannot use suds from VS with IronPython - python

I'm developing a WPF IronPython application with VS 2015. I have to send a SOAP call and to read the answer so I'm trying to get suds to work. Since both pip and easy_install failed to install it, I downloaded the sources, unzipped them, and put them in the site-packages folder. It worked, now I can see them from VS.
When I try to use these modules however the program crashes, this is what I have done:
from suds import *
from suds.client import Client
class Utils(object):
def doStuff(addr, mail):
cl = Client(addr, verify=False)
cl.service.authenticate(email)
cl.service.otherFunctions(...)
I know that not every module works with IronPython, so my question is: have I made some error? Or is it suds that doesn't work with IronPython? If the second, do you know of alternatives?
Thank you.

Related

Erwin API with Python

I am trying to get clear concept on how to get the Erwin generated DDL objects with python ? I am aware Erwin API needs to be used. What i am looking if what Python Module and what API needs to used and how to use them ? I would be thankful for some example !
Here is a start:
import win32com.client
ERwin = win32com.client.Dispatch("erwin9.SCAPI")
I haven't been able to browse the scapi dll so what I know is from trial and error. Erwin publishes VB code that works, but it is not straightforward to convert.
Install pywin32 (run the below from pip folder e.g. c:\Program Files\Python37\Scripts)
python -m pip install pywin32
python pywin32_postinstall.py -install
Sample script to extract DDL using Erwin's Forward Engineer functionality (change paths accordingly):
import win32com.client
api = win32com.client.Dispatch("erwin9.SCAPI")
unit = api.PersistenceUnits.Add("c:/models/data_model.erwin", "RDO=Yes")
unit.FEModel_DDL("c:/scripts/ddl_script.sql")
For the above to work, Erwin application should be running (probably).

RuntimeError: No recommended backend was available. (Keyring w/ Python)

I have a program which uses Yagmail and the keyring package to safley store email credentials. When I run this script in atom.io and idle it works.
However, after I packaged it with pyinstaller it is giving me this message:
RuntimeError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
In my program I have
import keyring
I also have gone and installed keyring.alt
Since i cant add comments, i am adding my inputs in answer block. hope this helps.
I also had similar issue, where i used a keyring module to store passwordin my python script and packaged it using pyinstaller. My script ran perfect when i run it directly. But when i try to run the python exe , i got same error as below
"RuntimeError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details."
I googled about this error and found below link (this may not be directly related but there someone gave a workaround). I added the workaround as suggested in the link (you have get which keyring backend you are using as well) and it worked.
Link: https://github.com/jaraco/keyring/issues/359
Code to find which keyring backend you are using
from keyring import get_keyring
get_keyring()
As suggested in the above like you can add the block somewhere in your script and then exe file will run perfectly.
Here's what I did, based on #Rena76's answer:
To get the default 'method' used to store the password, I imported get_keyring from keyring and executed the said function.
from keyring import get_keyring
print("Keyring method: " + str(get_keyring()))
The retrieved method was 'keyring.backends.chainer.ChainerBackend', which works fine on the script but not when exported to an .exe file. So I set 'keyring.backends.Windows.WinVaultKeyring' as my method, given that I'm using Windows.
keyring.core.set_keyring(keyring.core.load_keyring('keyring.backends.Windows.WinVaultKeyring'))
Finally, so that I'm able to save the credentials on Windows Vault, I'll import win32 libraries.
import win32api, win32, win32timezone
Now I can successfully perform Keyring functions, such as:
keyring.set_password(service_name='<service>', username='<username>', password='<password>')

error in Crypto.Cipher.IDEA module in python

Hello there,
i am writing a code for auto discovery of IP within the network and then
data transfer using the socket programming in python. I have read the RSA
and want to implement in the code. i go through to the link where i got
the code implementation and the whole code for server and client.
Here is the link where the code is:
<https://riptutorial.com/python/example/27170/client-side-implementation>
<https://riptutorial.com/python/example/27169/server-side-implementation>
There are two links and the setup for PyCrypto is.
*PyCrypto (Download Link: https://pypi.python.org/pypi/pycrypto )
*PyCryptoPlus (Download Link: https://github.com/doegox/python-cryptoplus )
i tried it on raspberry pi and install all the essential modules which i wrote above, and run it using the command line as follows:
python3 server.py
but it gives me some module related errors.
Crypto.Cipher.IDEA isn't available. You're probably using the Debian
pycrypto version. Install the original pycrypto for IDEA.
Traceback (most recent call last):
File "serverRsa.py", line 10, in <module>
from CryptoPlus.Cipher import IDEA
File "/home/pi/.local/lib/python3.5/site-
packages/CryptoPlus/Cipher/IDEA.py", line 4, in <module>
import Crypto.Cipher.IDEA
ImportError: No module named 'Crypto.Cipher.IDEA'
i tried it using the pip install PyCrypto and using the same with pip3.
and then run the same code but same error occurred.
Actually problem statement is to auto discover of all the nearby ip's
using the python programming , where i run the code on Raspberry Pi and
make it as a hotspot and other Pi boards act as client. Now when the
server found the client or discover them then it register them using some
key or encryption method.
i just need or code that passes some message to client using RSA but it seems the code have error.
Anyone please fix this issue.
Crypto.Cipher doesn't have any attribute named: IDEA.
import Crypto.Cipher.IDEA #won't work -_-
Maybe what you are looking for is CryptoPlus:
import CryptoPlus.Cipher.IDEA
If you really need an IDEA cipher in Python 2, and it's OK for you that it's slow (much slower than if it was implemented in C), there is one here: https://pastebin.com/hTn5K3Tx . Use it like this:
cb = IDEA('2bd6459f82c5b300952c49104881ff48'.decode('hex'))
plaintext, ciphertext = 'f129a6601ef62a47'.decode('hex'), 'ea024714ad5c4d84'.decode('hex')
assert cb.encrypt(plaintext) == ciphertext
assert cb.decrypt(ciphertext) == plaintext
Please note that the last patent on IDEA expired in 2012, and now IDEA is free to use for the public.
Standard Crypto Ciphers installed with pip install pycrypto now is version 2.6.1 and because of license restrictions it doesn't include IDEA (Crypto.Cipher.IDEA)
If you want to install Crypto.Cipher.IDEA you must find pycrypto-2.0.1 (freely available for download) which was last used to embedded this crypto cipher see pts comment above. Then follow the standard procedure to install the package pycrypto
python setup.py install
Problem appear if want to install IDEA for pyton3.

Problems Using CEX API in Python-- Cannot use module.

I am currently attempting to use the cex.io Python API for accessing financial data. Here is a link to github with the library: https://github.com/matveyco/cex.io-api-python
I installed it on MacOS X by using "python setup.py install" in Terminal. In the link above, it says to initialize the class we should use the following:
import cexapi
api = cexapi.api(username, api_key, api_secret)
However, when I put this code in a .py file in a directory without any other files, bash responds with:
AttributeError: 'module' object has no attribute 'api'
I am pretty sure the library is correctly installed (Python has no problem importing cexapi). It is clear to me that there is something about Python objects that I don't understand or I must have incorrectly installed the module.
Just in case it helps, I ran the following in the Python interpreter:
import cexapi
cexapi.__file__
And got the following:
'/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/cexapi-0.1-py3.4.egg/cexapi/__init__.py'
This command should show where the module is stored. Any help would be greatly appreciated, as I need to use this API. Thanks.
use upper case letters:
import cexapi
api = cexapi.API(username, api_key, api_secret)

import clientsecrets ImportError: No module named 'clientsecrets'

I have installed google-api-python-client library using pip3.4 Iam following tutorial from google authenicating client library so every time i run the python code provided by google to authenticate client library throws error as
import clientsecrets ImportError: No module named 'clientsecrets'
I have only python3.4 running on my pc and no other python. it might be similar thread to one here Python can't find module 'clientsecrets' when trying to set up oauth2 in Django using the Google Python API
but i found no solution there.
The python code i got from google is here
https://developers.google.com/maps/documentation/tracks/auth#authenticating_using_a_client_library
The library doesn't support Python 3. As of PEP 404:
In Python 3, implicit relative imports within packages are no longer available - only absolute imports and explicit relative imports are supported.
The oauth2client library uses import clientsecrets, which for Python 3 would need to be rewritten as from . import clientsecrets. Even if you changed those, the rest of the library would still be incompatible with Python 3.
There's at least one fork for Python 3 development, but it doesn't seem to be a big priority for the project. Until then, you'll have to find another library or write a wrapper yourself with requests for the functionality you need.

Categories