flickrAPI groups_leave()给出错误

时间:2013-02-09 03:16:30

标签: python python-2.7 flickr

当我尝试从FlickrAPI运行<Element 'rsp' at 0x2f25830> Error: 99: Insufficient permissions. Method requires delete privileges; write granted.时,我一直收到groups_leave()错误。

我使用people_getGroups()并且它像冠军一样运行,因此我使用了相同的代码,将people_getGroups()更改为groups_leave()并且它只是弯曲&amp;我。 :(

##  Python 2.73
##
##  Patterned after http://stackoverflow.com/questions/3182269/retrieving-flickr-favorites
##

import fileinput
import time
import flickrapi

Start = time.time()

g = 0

api_key    = 'Thisisnotreallyit'
api_secret = "ifItoldyou,I'dhavetokillyou"

flickr = flickrapi.FlickrAPI(api_key, api_secret)

uNSIDfile = '\flickrAPI\Test\GrpLeave.ttxt'

InFile  = open(uNSIDfile)
OutFile = open('C:\flickrAPI\Test\LeftGrp.ttxt', mode='w')

# group = '1569978@N25 '
for group in InFile:
    group = group [:-1]  # gets rid of{CR}{LF}

    g += 1
    if '@N' in group:
            try:
                    Grp = flickr.groups_leave(group_id = group)
                    fErr = ''
                    tup = 'Left Group {0}\n'.format(Grp)
                    OutFile.write(tup.encode('utf-8'))

            except flickrapi.FlickrError as fErr:
                    tup = str(Grp) + '\t' + str(fErr) + '\n'
                    OutFile.write(tup.encode('utf-8'))

            print('Left group: {0} \t {1}'.format (Grp, str(fErr)))
            group = ''

    else:
            pass

print('{0} groups \n'.format (g))
print(" Processing time: {1}:{0}".format ( int(( time.time()-Start) % 60), int((time.time()-Start)/60)))

InFile.close()
OutFile.close()

我尝试从控制台运行它&amp;它给了我:

>>> group = '1389232@N25'
>>> Grp = flickr.groups_leave(group_id = group)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
        ##
  File "c:\python27\lib\site-packages\flickrapi\flickrapi\__init__.py", line 349, in handler
        parse_format=args['format'], **args)
  File "c:\python27\lib\site-packages\flickrapi\flickrapi\__init__.py", line 435, in __wrap_in_parser
        return parser(self, data)
  File "c:\python27\lib\site-packages\flickrapi\flickrapi\__init__.py", line 278, in parse_etree
        raise FlickrError(u'Error: %(code)s: %(msg)s' % err.attrib)
FlickrError: Error: 99: Insufficient permissions. Method requires delete privileges; write granted.
>>>

1 个答案:

答案 0 :(得分:0)

好的,再一次,我有'金发时刻'! enter image description here

在服务网站http://www.flickr.com/services/api/flickr.groups.leave.html,它指出: 注意: 此方法需要HTTP POST请求。

我还没有学会如何格式化那些,但那是另一天,呃?