Skip to content

Commit c726341

Browse files
committed
Update up.flickr.com endpoint & content-length bug
Update for upload/replace end points - fixes #10 Added explicit setting of “Content-Length” for POST requests to fix #11
1 parent 639339d commit c726341

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

flickr.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'''
77

88
__author__ = 'Mike Helmick <[email protected]>'
9-
__version__ = '0.3.0'
9+
__version__ = '0.3.2'
1010

1111
import urllib
1212
import urllib2
@@ -112,9 +112,10 @@ def __init__(self, api_key=None, api_secret=None, oauth_token=None, oauth_token_
112112
self.callback_url = callback_url
113113

114114
self.api_base = 'https://api.flickr.com/services'
115+
self.up_api_base = 'https://up.flickr.com/services'
115116
self.rest_api_url = '%s/rest' % self.api_base
116-
self.upload_api_url = '%s/upload/' % self.api_base
117-
self.replace_api_url = '%s/replace/' % self.api_base
117+
self.upload_api_url = '%s/upload/' % self.up_api_base
118+
self.replace_api_url = '%s/replace/' % self.up_api_base
118119
self.request_token_url = 'https://www.flickr.com/services/oauth/request_token'
119120
self.access_token_url = 'https://www.flickr.com/services/oauth/access_token'
120121
self.authorize_url = 'https://www.flickr.com/services/oauth/authorize'
@@ -192,6 +193,7 @@ def get_auth_tokens(self, oauth_verifier):
192193

193194
def api_request(self, endpoint=None, method='GET', params={}, files=None, replace=False):
194195
self.headers.update({'Content-Type': 'application/json'})
196+
self.headers.update({'Content-Length': '0'})
195197

196198
if endpoint is None and files is None:
197199
raise FlickrAPIError('Please supply an API endpoint to hit.')

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name='python-flickr',
7-
version='0.3.1',
7+
version='0.3.2',
88
install_requires=['httplib2', 'oauth2', 'simplejson'],
99
author='Mike Helmick',
1010
author_email='[email protected]',

0 commit comments

Comments
 (0)