Skip to content

Move from genimage —> v2/images/ #201

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

Merged
merged 1 commit into from
Mar 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions plotly/plotly/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import six
import base64
import requests
from requests.auth import HTTPBasicAuth

if sys.version[:1] == '2':
from urlparse import urlparse
Expand Down Expand Up @@ -582,25 +583,22 @@ def get(figure_or_data, format='png', width=None, height=None):
credentials = get_credentials()
validate_credentials(credentials)
username, api_key = credentials['username'], credentials['api_key']
headers = {'plotly-username': username,
'plotly-apikey': api_key,
'plotly-version': version.__version__,
'plotly-platform': 'python'}

payload = {
'figure': figure,
'format': format
}
headers = {'Plotly-Version': version.__version__,
'Content-Type': 'application/json',
'Plotly-Client-Platform': 'python'}

payload = {'figure': figure, 'format': format}
if width is not None:
payload['width'] = width
if height is not None:
payload['height'] = height

url = get_config()['plotly_domain'] + "/apigenimage/"
url = _api_v2.api_url('images/')

res = requests.post(
url, data=json.dumps(payload, cls=utils.PlotlyJSONEncoder),
headers=headers, verify=get_config()['plotly_ssl_verification']
headers=headers, verify=get_config()['plotly_ssl_verification'],
auth=HTTPBasicAuth(username, api_key)
)

headers = res.headers
Expand Down