Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module is not working #5

Open
hygull opened this issue Mar 4, 2018 · 1 comment
Open

Module is not working #5

hygull opened this issue Mar 4, 2018 · 1 comment

Comments

@hygull
Copy link

hygull commented Mar 4, 2018

Today, I installed python_wpapi using pip and tried to execute my main.py file but failed.

The following is the install history on GIT BASH (Windows 10).

rishikesh agrawani@DESKTOP-8AATOO4 MINGW64 /d/projects/Tasks/PyLaTex/wordpress-api/src
$ pip install python_wpapi
Collecting python_wpapi
  Using cached python_wpapi-0.3.1-py2.py3-none-any.whl
Requirement already satisfied: requests in c:\anacondapython2.5.0.1\lib\site-packages (from python_wpapi)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi)
Requirement already satisfied: idna<2.7,>=2.5 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi)
Requirement already satisfied: certifi>=2017.4.17 in c:\anacondapython2.5.0.1\lib\site-packages (from requests->python_wpapi)
Installing collected packages: python-wpapi
Successfully installed python-wpapi-0.3.1

Now I created 2 files main.py and config.py inside my current directory /d/projects/Tasks/PyLaTex/wordpress-api/src.

config.py

USERNAME = "hygull";
PASSWORD = "^([A-Zm-z]{0-9})(WdPrs)$";

main.py

import config
from python_wpapi import WpApi;

username = config.USERNAME;
password = config.PASSWORD;

api1 = WpApi("https://hygull.wordpress.com");
print api1.get_posts();

When I tried to run, it shows me error as follows.

rishikesh agrawani@DESKTOP-8AATOO4 MINGW64 /d/projects/Tasks/PyLaTex/wordpress-api/src
$ python main.py
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    from python_wpapi import WpApi;
ImportError: cannot import name WpApi
@yashrs
Copy link

yashrs commented Jun 27, 2018

@hygull Try using from python_wpapi.python_wpapi import WpApi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants