Rich-text Reply

Python 3 API

blodwyn_pig 10-10-16

Python 3 API

Hi, I am simply trying to get the results of our experiments using Python 3 and am not getting anywhere. I am unable to find what I need in the REST API instructions, and the Python Client API only seems to be written for Python 2. Am I missing something pretty basic? Could someone point me in the direction of some guidelines? Thanks B
Brian_Abad 10-12-16
 

Re: Python 3 API

Thanks for reaching out. Currently, all of our available REST API calls are present within our developer documentation. Here is the link that leads specifically to retrieving results using the REST API: https://developers.optimizely.com/classic/rest/v1/#results.

Have you had a chance to look into this section? This is our available documentation around REST API but if you have a feature request I'd be happy to submit one for you.
---
Brian Abad
Manager, Technical Support
Customer Success
Optimizely
DougC 10-12-16
 

Re: Python 3 API

I'm running Python 3.06. Here is a simple python script that I called "rest.py" that uses Optimizely's REST API. Note that you need to substitute MY_TOKEN with your actual Optimizely API token which looks something like "1123123123123c3kd28clklkjelkjlkj:ke123123"

import requests
url = 'https://www.optimizelyapis.com/experiment/v1/projects/'
headers = ('Token':'MY_TOKEN'}
r = requests.get(url, headers=headers)
print(r.text)

Then run "python rest.py".
This should display your experiments' metadata. Let me know how it goes.
Doug C
Level 3
blodwyn_pig 10-18-16
 

Re: Python 3 API

Thanks a lot Doug, that's very useful.

 

Cheers

Ricky