Skip to content

Commit

Permalink
feat(samples): python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
gierschv committed Mar 23, 2022
1 parent 557800a commit 487390f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion spec/code_samples/Python/me/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
try:
pprint(flat_api.AccountApi(flat_api_client).get_authenticated_user())
except ApiException as e:
print e
print(e)
10 changes: 6 additions & 4 deletions spec/code_samples/Python/scores/post.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from pprint import pprint
import os, urllib2
import os
from urllib.request import urlopen
from urllib.error import HTTPError

import flat_api
from flat_api.rest import ApiException
Expand All @@ -12,7 +14,7 @@

try:
# Download a MusicXML "Hello World"
hello_world = urllib2.urlopen(SCORE_TO_IMPORT).read()
hello_world = urlopen(SCORE_TO_IMPORT).read().decode('utf-8')

# The new score meta, including the MusicXML file as `data`
new_score = flat_api.ScoreCreation(
Expand All @@ -23,5 +25,5 @@

# Create the document and print the meta returned by the API
pprint(flat_api.ScoreApi(flat_api_client).create_score(new_score))
except (ApiException, urllib2.HTTPError) as e:
print e
except (ApiException, HTTPError) as e:
print(e)

0 comments on commit 487390f

Please sign in to comment.