Skip to content

Commit db9384a

Browse files
authored
Merge pull request #1 from jdrzj/master
spreadsheet_id maybe spreadsheet_url
2 parents ce7a308 + 32e7707 commit db9384a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sheetsu/core/core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
import json
33
import requests
4+
import re
45
from requests.auth import HTTPBasicAuth
56

67
from sheetsu.exceptions import UnknownRequestMethod
@@ -19,7 +20,7 @@ class Resource(object):
1920
def __init__(self, client):
2021
"""Initialize Sheetsu Resource variables
2122
:param client: "SheetsuClient" object instance"""
22-
self.sheetsu_api_url = "https://sheetsu.com/apis/v1.0/"
23+
self.sheetsu_api_url = "https://sheetsu.com/apis/v1.0oy/"
2324
self.api_key = client.api_key
2425
self.api_secret = client.api_secret
2526
self.spreadsheet_id = client.spreadsheet_id
@@ -31,7 +32,14 @@ def __call__(self, *args, **kwargs):
3132
:param data: optional, only for 'post' and 'put'
3233
:return: requests instance"""
3334
# build url to make request
34-
url = "{}{}".format(self.sheetsu_api_url, kwargs.pop('url'))
35+
36+
url = kwargs.pop('url')
37+
result = re.search(r"sheetsu.com/apis/v1", url)
38+
if bool(result):
39+
url = "{}".format(url)
40+
else:
41+
url = "{}{}".format(self.sheetsu_api_url, url)
42+
3543
# decide which HTTP request to make
3644
method = kwargs.pop('method')
3745
if method == 'get':

0 commit comments

Comments
 (0)