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

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)

Related

Can't access Aliexpress functions in top.api

I'm just started to search Aliexpress-API documentation. In there: Developers.aliexpress , Im coding in python and need to import AliexpressSolutionProductPostRequest from top.api but it fails.
I installed top lib on Windows like that: python -m pip install top
Reinstalled twice but it fails. Its official website and fails. I can't figure it out.
AttributeError: module 'top.api' has no attribute 'AliexpressSolutionProductPostRequest'
This library has diffrent functions for Alibaba , not for aliexpres. Any suggestion for fix that ? Actually i can't find top library's offical documentation too.Thank you..
Okey. I found this library for fix that error. We need to install aliexpress-sdk:
pip install aliexpress-sdk
or (for pre-release):
pip install git+https://github.com/bayborodin/aliexpress-sdk
Now I can import Aliexpress modules which are in Aliexpress API Documentation.
Example module import for aliexpress:
from aliexpress.api import AliexpressSolutionProductPostRequest
I just learned offical way to do that.
After create an app on Aliexpress Console, you can generate API SDK for Python. In there you can find top library's functions which are in Aliexpress API Documentation. So we need to create App first, once accepted , we can do all these stuff.

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).

How can I access to library " plot_utils " in python?

I need this library "plot_utils" for analysis and plotting but I can't find it in the web. this library is related to Brian2 (a library in python) for spiking neural network.
I installed brian2 through anaconda. when I want to import plot_utils and using in my code I receive error :
ModuleNotFoundError: No module named 'plot_utils'
Could you please help me?
You need to give more info about where did you stumble upon that name, eg some copied code etc.
With the only reference you've given (ie. brian2) this seems related.
https://brian2.readthedocs.io/en/stable/examples/frompapers.Stimberg_et_al_2018.plot_utils.html
Maybe just copy that code into a file named 'plot_utils.py' and keep it at the path your code is searching for it.
First, you need to install the module in your work environment using "pip install plot_utils" then you can import the library using "import plot_utils".
This link will help you: https://libraries.io/pypi/plot-utils[this is the official documentation from plot_utils]

Google calendar API error under Python3

I'm working with the google-api-python-client library with the following setup:
Python3.4.3 in a virtual environment (using pip8.1.1)
I'm getting error from the following code: AttributeError: 'module' object has no attribute 'file'
store = oauth2client.file.Storage(credential_path)
The code is from the Google Python Quickstart example and runs fine under Python 2.7.10
Thanks in advance!
I was able to get it to work by rewriting the import statement:
from oauth2client.file import Storage
Not sure why this works, but it does.

Cannot use suds from VS with IronPython

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.

Categories