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
31f1f442
Commit
31f1f442
authored
Jun 06, 2017
by
Tarun Bhardwaj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add request based client
parent
5291e67d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
_core.py
etsy/_core.py
+4
-0
request_oauth.py
etsy/request_oauth.py
+28
-0
setup.py
setup.py
+2
-0
No files found.
etsy/_core.py
View file @
31f1f442
...
@@ -300,6 +300,10 @@ class API(object):
...
@@ -300,6 +300,10 @@ class API(object):
fields
.
append
((
name
,
str
(
value
)))
fields
.
append
((
name
,
str
(
value
)))
content_type
,
body
=
encode_multipart_formdata
(
fields
,
files
)
content_type
,
body
=
encode_multipart_formdata
(
fields
,
files
)
else
:
url
=
'
%
s
%
s'
%
(
self
.
api_url
,
url
)
body
=
urlencode
(
kwargs
)
content_type
=
'application/x-www-form-urlencoded'
self
.
last_url
=
url
self
.
last_url
=
url
data
=
self
.
_get_url
(
url
,
http_method
,
content_type
,
body
)
data
=
self
.
_get_url
(
url
,
http_method
,
content_type
,
body
)
...
...
etsy/request_oauth.py
0 → 100644
View file @
31f1f442
from
etsy
import
EtsyEnvProduction
from
requests_oauthlib
import
OAuth1Session
class
EtsyOAuthClient
(
OAuth1Session
):
def
__init__
(
self
,
oauth_consumer_key
,
oauth_consumer_secret
,
etsy_env
=
EtsyEnvProduction
()):
super
(
EtsyOAuthClient
,
self
)
.
__init__
(
oauth_consumer_key
,
oauth_consumer_secret
)
self
.
request_token_url
=
etsy_env
.
request_token_url
self
.
access_token_url
=
etsy_env
.
access_token_url
self
.
signin_url
=
etsy_env
.
signin_url
def
get_signin_url
(
self
,
**
kwargs
):
self
.
fetch_request_token
(
self
.
request_token_url
)
return
self
.
authorization_url
(
self
.
signin_url
)
def
set_oauth_verifier
(
self
,
oauth_verifier
):
token
=
self
.
fetch_access_token
(
self
.
access_token_url
,
verifier
=
unicode
(
oauth_verifier
))
self
.
resource_owner_key
=
token
[
'oauth_token'
]
self
.
resource_owner_secret
=
token
[
'oauth_token_secret'
]
def
do_oauth_request
(
self
,
url
,
http_method
,
content_type
,
body
):
headers
=
{}
if
content_type
:
headers
=
{
'Content-Type'
:
content_type
}
return
self
.
request
(
http_method
,
url
,
headers
=
headers
,
data
=
body
)
.
text
setup.py
View file @
31f1f442
...
@@ -9,6 +9,8 @@ requirements = [
...
@@ -9,6 +9,8 @@ requirements = [
'httplib2'
,
'httplib2'
,
'oauth2==1.9.0.post1'
,
'oauth2==1.9.0.post1'
,
'simplejson'
,
'simplejson'
,
'requests'
,
'requests_oauthlib'
,
]
]
test_requirements
=
[
test_requirements
=
[
...
...
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