File: oauth_test_3.py

package info (click to toggle)
python-flickrapi 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: python: 2,145; makefile: 147; sh: 10
file content (35 lines) | stat: -rwxr-xr-x 923 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python

from xml.etree import ElementTree as ET
import logging
logging.basicConfig(level=logging.INFO)

from flickrapi import FlickrAPI


class keys:
    apikey = u'a233c66549c9fb5e40a68c1ae156b370'
    apisecret = u'03fbb3ea705fe096'

print('Creating FlickrAPI object')

flickr = FlickrAPI(keys.apikey, keys.apisecret)
#
#token = flickr.token_cache.token
#flickr.flickr_oauth.token = token
#print('Step 0: check token %r' % token.token)
#
#resp = flickr.auth.oauth.checkToken(format='etree')
#ET.dump(resp)
#raise SystemExit()

# ------------------------------------------------------------------------------
print('Step 1: authenticate')
# flickr.authenticate_via_browser(perms='read')
flickr.authenticate_console(perms='read')

# ------------------------------------------------------------------------------
print('Step 2: user Flickr')
resp = flickr.photos.getInfo(photo_id='7658567128')

ET.dump(resp)