1
Google for Pythonで提供されているgdataライブラリを使用して、Google Appsドメインからプロフィールフィードを取得しようとしています。Google Appsからのプロフィールフィードの入手
C:\Python27\Lib\gdata-2.0.16>python contactAPI.py
Enter max return: 300
Traceback (most recent call last):
File "contactAPI.py", line 27, in <module>
feed_uri = gd_client.GetProfilesFeed()
File "build\bdist.win-amd64\egg\gdata\contacts\service.py", line 294, in GetProfilesFeed
File "build\bdist.win-amd64\egg\gdata\service.py", line 1108, in Get
gdata.service.RequestError: {'status': 403, 'body': 'Version 1.0 is not supported.', 'reason': 'Forbidden'}
私はGetContactsFeedや他のフィードを使用することが、私は、プロファイルを取得することはできません。これは私がこれを実行すると、それは返す私のコード
import atom
import gdata.auth
import gdata.contacts
import gdata.contacts.service
gd_client = gdata.contacts.service.ContactsService()
gd_client.email = '[email protected]'
gd_client.password = 'password'
gd_client.source = 'madeupgibberish'
gd_client.account_type = 'HOSTED'
gd_client.contact_list = 'domain.com'
gd_client.ProgrammaticLogin()
def PrintFeed(feed):
for i, entry in enumerate(feed.entry):
print '\n%s %s' % (i+1, entry.title.text)
max_results = raw_input(
'Enter max return: ')
feed_uri = gd_client.GetProfilesFeed()
query = gdata.contacts.service.ContactsQuery(feed_uri)
print(feed_uri)
query.max_results = max_results
#query.orderby='title'
feed = gd_client.GetContactsFeed(query.ToUri())
# Use the print feed method defined above.
PrintFeed(feed)
print(feed_uri)
#print feed
f = open('c:\\python27\\junk.xml', 'w')
f.write(str(feed))
f.close()
です。ここで何が起きているのか、何を修正する必要があるのでしょうか?ご協力いただきありがとうございます。
これは素晴らしい結果でしたが、60項目しか返しませんでした。私はmax_resultsを追加しようとしていますが、まだ60点しか得ていません。 – Kevin
すべてのプロファイルエントリを取得するコードを編集しました。 – Shadow