BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etsy-python
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
etsy-python
Commits
3099b2a3
Commit
3099b2a3
authored
Jun 07, 2017
by
Tarun Bhardwaj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add better exceptions
parent
fd53093f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
_core.py
etsy/_core.py
+6
-0
exceptions.py
etsy/exceptions.py
+6
-0
test_v2.py
etsy/test_v2.py
+2
-0
No files found.
etsy/_core.py
View file @
3099b2a3
...
...
@@ -9,6 +9,8 @@ import tempfile
import
time
from
_multipartformdataencode
import
encode_multipart_formdata
from
.exceptions
import
EtsyConcurrencyError
,
EtsyAPILimitError
missing
=
object
()
...
...
@@ -314,6 +316,10 @@ class API(object):
try
:
self
.
data
=
self
.
decode
(
data
)
except
json
.
JSONDecodeError
:
if
'being edited by another process'
in
data
:
raise
EtsyConcurrencyError
(
data
)
if
'exceeded your quota'
in
data
:
raise
EtsyAPILimitError
(
data
)
raise
ValueError
(
'Could not decode response from Etsy as JSON:
%
r'
%
data
)
...
...
etsy/exceptions.py
0 → 100644
View file @
3099b2a3
class
EtsyConcurrencyError
(
Exception
):
pass
class
EtsyAPILimitError
(
Exception
):
pass
etsy/test_v2.py
View file @
3099b2a3
...
...
@@ -30,6 +30,7 @@ def write_config_file(oauth_token):
config_file
.
write
(
"oauth_token_key =
%
r
\n
"
%
oauth_token
.
key
)
config_file
.
write
(
"oauth_token_secret =
%
r
\n
"
%
oauth_token
.
secret
)
try
:
import
config
except
ImportError
:
...
...
@@ -94,4 +95,5 @@ def testCreateListing():
print
"Result of uploading image:
%
r"
%
result
testCreateListing
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment