Jump to content

Recommended Posts

Hopefully this is very simple question(s) for those of you experienced with Python, but this is a new avenue for me!

At the moment I am just trying to get the Example (example.py) to run, but at the moment I just get syntax error when attempting to run it in Python 3.6.2.

https://github.com/hornbill/pythonApiLib

I think I have updated the correct lines to include our instance and API Key, but one question on the former is this just the instance name or the full URL?

Also do I need to put the exception.py and xmlmc.py in a specific location in the Python folder so they are picked up.

Cheers

Martyn

Link to comment
Share on other sites

@TrevorKillick

Ok getting a bit further, but the xmlxc seems to be trying to load request.py and will also want warnings.py, but they are not include on the GitHub folder, unless these are generic modules?

from lxml import etree
import base64
import requests
import exception
import warnings

So get the error below:-

xmlxc.PNG.efb12c8644c8387a40bd09418c5bfe4b.PNG

github.PNG.a01fccba2ed3d3bdc4256d54491e775c.PNG

Cheers

Martyn

Link to comment
Share on other sites

@Martyn Houghton

For my install of python requests is part of site-packages so i must have installed it at some point as with lxml if you do pip install for any missing package and let me know if anything other than requests needs to be installed and i will update the documentation. 

Sorry about the inconvenience.

Kind Regards

Trevor Killick 

Link to comment
Share on other sites

@TrevorKillick

After doing 'pip install requests' from the python scripts folder, the example.py will run and complete.

To confirm I just added the following print lines to the if statement to prove it had connected, else all you get in the fact that it completes without an error.

if XmlmcHelper.is_call_success(json_string):
    user_id = XmlmcHelper.get_param_value(json_string, "params/userId")
    time_zone = XmlmcHelper.get_param_value(json_string, "params/regionalSettings/timeZone")
    print(user_id)
    print(time_zone)
else:
    print(XmlmcHelper.get_error_message(json_string))

Cheers

Martyn

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...