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
881ede0d
Commit
881ede0d
authored
Aug 31, 2021
by
Forest Godfrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a few issues with encoding
parent
d4a1f866
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
_core.py
etsy/_core.py
+4
-0
_multipartformdataencode.py
etsy/_multipartformdataencode.py
+11
-2
No files found.
etsy/_core.py
View file @
881ede0d
...
...
@@ -302,10 +302,14 @@ class API(object):
fields
.
append
((
name
,
str
(
value
)))
content_type
,
body
=
encode_multipart_formdata
(
fields
,
files
)
if
url
.
find
(
"inventory"
)
>
0
:
self
.
log
(
"Body = "
+
str
(
body
))
else
:
url
=
'
%
s
%
s'
%
(
self
.
api_url
,
url
)
body
=
urlencode
(
kwargs
)
content_type
=
'application/x-www-form-urlencoded'
if
url
.
find
(
"inventory"
)
>
0
:
self
.
log
(
"Body = "
+
str
(
body
))
self
.
last_url
=
url
data
=
self
.
_get_url
(
url
,
http_method
,
content_type
,
body
)
...
...
etsy/_multipartformdataencode.py
View file @
881ede0d
...
...
@@ -31,7 +31,13 @@ def encode_multipart_formdata(fields, files):
"""
BOUNDARY
=
'----------ThIs_Is_tHe_bouNdaRY_$'
CRLF
=
'
\r\n
'
L
=
byteEncoder
(
CRLF
)
L
=
[]
if
files
and
(
len
(
files
)
>
0
):
print
"encode_multipart_formdata Using byteEncoder"
L
=
byteEncoder
(
CRLF
)
else
:
print
"encode_multipart_formdata: Using Normal API for request encoding"
for
(
key
,
value
)
in
fields
:
L
.
append
(
'--'
+
BOUNDARY
)
L
.
append
(
'Content-Disposition: form-data; name="
%
s"'
%
key
)
...
...
@@ -47,7 +53,10 @@ def encode_multipart_formdata(fields, files):
L
.
append
(
value
)
L
.
append
(
'--'
+
BOUNDARY
+
'--'
)
L
.
append
(
''
)
body
=
L
.
value
()
if
files
and
(
len
(
files
)
>
0
):
body
=
L
.
value
()
else
:
body
=
CRLF
.
join
(
L
)
content_type
=
'multipart/form-data; boundary=
%
s'
%
BOUNDARY
return
content_type
,
body
...
...
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