Git Product home page Git Product logo

flickrpy's People

Contributors

jimr avatar

Watchers

 avatar

flickrpy's Issues

Retrieve user location of photo

Hi, sorry I'm relatively new to python. I have a question regarding my code. 
I'm stuck when I try to scrape the user's locations (not the picture's 
locations). Here's my code:

#FLICKR API SCRIPT
from flickr import *

#PERSONAL API KEY & PASSWORD
flickr.API_KEY = '8a5710b69be295ec77a205XXXXXXXXXX'
flickr.API_SECRET = '41e94XXXXXXXXX'

#GET PHOTOS BY TAG:
photos = photos_search(tags='manhattan', pages= '2', per_page='100')
print len(photos)
print photos

#GET PHOTO LOCATION:
geolist = []
for i in photos:
    if i.getLocation() != None:
        geolist.append(i.getLocation())
print len(geolist)
print geolist

#GET USERS:
owners = []
for i in photos:
    if i.getLocation() != None:
        owners.append(i.owner)
print len(owners)
print owners

#GET USER PROPERTIES GENERAL:
ownerprop = []
for i in owners:
    ownerprop.append(i._load_properties)
print len(ownerprop)
print ownerprop

#GET USER LOCATION:
ownerloc = []
for i in owners:
    print i.__location

The general properties should include location of the owner, but they return 
this weird object I can't perform any functions on. Here's the link to the 
flickr module code: http://flickrpy.googlecode.com/svn/trunk/flickr.py

Any ideas?

Another thing is that the page maximum of pictures is 500 and I somehow can 
only pull data from 1 page, even though I set the "pages" parameter to 2, to 
'all', and few others I thought of. It never gives me error messages, but the 
data is pulled for only 500 images. Of those, only about 10-30% have geo tags, 
way too few to make a map...

Thanks in advance!

Original issue reported on code.google.com by [email protected] on 23 Oct 2014 at 10:19

photos.addTags() failed in _dopost()

Hello.

> What steps will reproduce the problem?
1. photo.addTags(["foo", "bar"])

> What is the expected output? What do you see instead?

I saw the following by debug = True

_dopost url 
http://flickr.com/services/rest/?api_key=XXXX&method=flickr.photos.addTags&&auth
_token=XXXX&api_sig=XXXX
_dopost payload photo_id=XXXX&method=flickr.photos.addTags&tags=foo%2Cbar
Traceback (most recent call last):
(snip)
  File "flickr.py", line 188, in addTags
    _dopost(method, auth=True, photo_id=self.id, tags=tags)
  File "flickr.py", line 916, in _dopost
    return _get_data(minidom.parse(urlopen(url, payload)))
  File "flickr.py", line 931, in _get_data
    raise FlickrError, msg
flickr.FlickrError: ERROR [112]: Method 
"flickr.photos.addTagsflickr.photos.addTags" not found

> What version of the product are you using? On what operating system?

Downloaded on Jan. 25th, 2011.

__author__ = "James Clarke <[email protected]>"
__version__ = "$Rev$"
__date__ = "$Date$"
__copyright__ = "Copyright: 2004-2010 James Clarke; Portions: 2007-2008 Joshua 
Henderson"

OS: Windows XP SP3 and Cygwin
Python 2.6.5

> Please provide any additional information below.

I've modified the code as below and now working.  I'm not sure if it's 
appropriate though.

In def _dopost(), (by diff -u)

     params = _prepare_params(params)
-    url = '%s%s/?api_key=%s&method=%s&%s'% \
-          (HOST, API, API_KEY, method, _get_auth_url_suffix(method, auth, 
params))
+    url = '%s%s/?api_key=%s%s'% \
+          (HOST, API, API_KEY, _get_auth_url_suffix(method, auth, params))

Thanks and Best Regards,
Atsushi Yokoyama

Original issue reported on code.google.com by [email protected] on 26 Jan 2011 at 2:27

AttributeError results from call to contacts_getPublicList when the contact is friendless

What steps will reproduce the problem?

1. search for a contact that doesn't have any friends via the
contacts_getPublicList call

What is the expected output? What do you see instead?

Expected output would be an empty list back. Instead the following error
occurs:

File "/Users/matthew/Desktop/social/flickr.py", line 743, in
contacts_getPublicList
    if isinstance(data.rsp.contacts.contact, list):
AttributeError: Bag instance has no attribute 'contact'

Obviously, it looks like you'd just need to wrap the call in a try/except
block or otherwise make sure it has the attribute you're looking for before
 trying to access it.

What version of the product are you using? On what operating system?
The latest version as of 6 Feb 08 with Python 2.5 on OS X 10.5.1

Please provide any additional information below.

I didn't write a patch, because it looked trivial enough to fix. Also, I
didn't verify that the same logic might not case the same error in other
places, but it looks like it may...For now, I'm just wrapping some of these
calls in try/except and catching the AttributeError as a mitigation step.

Great module btw. Very simple and easy to use!

Original issue reported on code.google.com by [email protected] on 6 Feb 2008 at 7:09

Flickr.py does not work with python2.6

What steps will reproduce the problem?
1. Include flickr.py using import flickr

What is the expected output? What do you see instead?

I expected flickr.py to work without errors, but I see several erros related to 
the file "flickr.py"

What version of the product are you using? On what operating system?
I am using the latest revision from the svn repository with python 2.6.

Please provide any additional information below.
I attached a file with the erros I get.

Regards,
Simao



Original issue reported on code.google.com by [email protected] on 10 Aug 2010 at 6:44

Attachments:

reduce server traffic patch

- add farm to photo data directly from flickr.groups.pools.getPhotos
- add username to user data directly from flickr.groups.pools.getPhotos
- do not get user info if needed data is already there

Original issue reported on code.google.com by [email protected] on 12 Sep 2013 at 4:39

Attachments:

_dopost method still uses the old version of authentication

What steps will reproduce the problem?
1. Download the most recent revision of flickr.py (revision 32 at time of
writing)
2. Setup authentication
3. Attempt to use the _dopost method with authentication

What is the expected output? What do you see instead?
The expected output is the function to be completed successfully using
authentication, rather an error is returned as it still uses the old version.

Please use labels and text to provide additional information.
This bug was brought to my attention by Adrian Ulges via email.

Original issue reported on code.google.com by [email protected] on 16 Apr 2008 at 3:59

new Auth issues

____ What steps will reproduce the problem?
From the interactive prompt ....
>>> import flickr
>>> oz = flickr.people_findByUsername('oztenphoto')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "flickr.py", line 668, in people_findByUsername
    data = _doget(method, username=username)
  File "flickr.py", line 877, in _doget
    api_signature = hashlib.md5(''.join(api_string)).hexdigest()
TypeError: sequence item 4: expected string, bool found

What version of the product are you using? On what operating system?
flickr.py r40. Linux

___ Please provide any additional information below.
I'm not familiar with the API Auth System changes you were trying to
account for, however, the people_findByUsername call works just fine on r39.

Also, on line 848 ... this just isn't right ...
if (auth != True) or (auth != False):

Original issue reported on code.google.com by [email protected] on 20 Aug 2008 at 5:14

Add getAllContexts method (patch included)

I needed to use the getAllContexts method as documented at 
http://www.flickr.com/services/api/flickr.photos.getAllContexts.html to get a 
count of pools/sets for a photo. I couldn't see this in the existing code so 
have added it, patch file is attached.

leejo@ubuntu:~/bin/flickrpy-read-only$ svn info flickr.py 
Path: flickr.py
Name: flickr.py
URL: http://flickrpy.googlecode.com/svn/trunk/flickr.py
Repository Root: http://flickrpy.googlecode.com/svn
Repository UUID: f27205ce-482c-0410-bd43-d700e4c7180c
Revision: 48
Node Kind: file
Schedule: normal
Last Changed Author: clarkeje
Last Changed Rev: 48
Last Changed Date: 2010-11-05 22:50:08 +0000 (Fri, 05 Nov 2010)
Text Last Updated: 2010-12-19 12:23:37 +0000 (Sun, 19 Dec 2010)
Checksum: 96de42728ec44e9337c86b36f0aefecb

Original issue reported on code.google.com by [email protected] on 20 Dec 2010 at 2:03

Attachments:

Exception raised if no photo at all

What steps will reproduce the problem?
1. Call Group.getPhotos, photos_search, people_getPublicPhotos,
favorites_getList, favorites_getPublicList or interestingness if there's no
photos at all!

A patch is attached (it's my first patch for open source, sorry if the
patch does not work)

Original issue reported on code.google.com by [email protected] on 30 Dec 2009 at 9:19

Attachments:

photos_search_pages does not use tag_mode

What steps will reproduce the problem?
1. Call photos_search_pages() with two tags and tag_mode set to 'all'
2. Result will not reflect 'all' (=logical AND) condition

Reason:
Call to _doget in photos_search_pages does not pass tag_mode parameter. Adding 
tag_mode = tag_mode to parameter list resolves the issue.

Original issue reported on code.google.com by [email protected] on 20 Dec 2014 at 11:31

cannot access private photos, even when authorized

What steps will reproduce the problem?

1. get authorized to read a user's private photos.
2. for i in flickr.photos_search(user_id='foobar', auth=True):
      print i.getURL(size='Large')
   # note that auth=True lists the private photos, too

What is the expected output? What do you see instead?

I expect to see the URL, but I get a stack trace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "flickr.py", line 225, in getSizes
    """
  File "flickr.py", line 1066, in _doget
    _get_auth_url_suffix(method, auth, params))
  File "flickr.py", line 1100, in _get_data
    def _get_data(xml):
flickr.FlickrError: ERROR [1]: Photo not found

(Line numbers may be off, because I've added a few comments to the top of the 
file.)

What version of the product are you using? On what operating system?

Download from 2012-05-02, running on Windows.

Please provide any additional information below.

A quick and dirty hack is to default the auth argument of _doget to True. That 
may or may not cause heaps of problems elsewhere, though.

Original issue reported on code.google.com by [email protected] on 2 May 2012 at 3:42

getPhotosets():Bag instance has no attribute 'photoset'

>>> user.getPhotosets()
<flickr.Bag instance at 0x00AB35F8>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "flickr.py", line 474, in getPhotosets
    if isinstance(data.rsp.photosets.photoset, list):
AttributeError: Bag instance has no attribute 'photoset'

Does not work as expected. Not yet tested by a developer, but will be
shortly. I will report back on the problem status shortly (marked as a high
priority)


Original issue reported on code.google.com by [email protected] on 3 May 2008 at 7:12

Get server farm

Given a photo object, the current release cannot retrieve a server farm ID,
which is needed for reconstructing a full embeddable image URL from a photo
ID. The attached patch to flickr.py enables the farm attribute, e.g.:

>>> import flickr
>>> flickr.API_KEY='string'
>>> from flickr import Photo
>>> photo = Photo(id='123456')
>>> photo.farm
u'3'



Original issue reported on code.google.com by [email protected] on 6 Dec 2009 at 12:46

Attachments:

_dopost()'s minidom returns errors

When calling _dopost(), I get an syntax error (traceback attached):
`xml.parsers.expat.ExpatError: syntax error: line 1, column 62`

To reproduce call any function that calls the _dopost() function, such as 
Photo.addTags. 

This error occurs both when Flickr returns xml and when it returns an empty 
success response.


Original issue reported on code.google.com by [email protected] on 8 Sep 2010 at 2:09

Attachments:

instanceof -&gt; isinstance

I was trying to get flickr.tags_getrelated() to work but it kept complaining 
about a bogus instanceof 
call. In the attached patch I renamed all “instanceof” to “isinstance”, 
now it’s working properly. 
-- 
Antonio Cavedoni (from Hackday 2007!)

Original issue reported on code.google.com by [email protected] on 17 Jun 2007 at 10:03

Attachments:

Simple usage documentation

It would be excellent if the basic usage documentation could be fleshed out
a bit more. I'm trying to get up to speed with this but not having much
luck. I'm able to do:

photo = Photo(id='3943332878')

But from that point, having trouble figuring out how to get things like
which farm and server an image is on. Reading the source code isn't
helping. All I want to do is to be able to construct an embed URL similar
to these:

http://www.flickr.com/services/api/misc.urls.html

Just a few pointers on basic usage would be super helpful, thanks.

Original issue reported on code.google.com by [email protected] on 5 Dec 2009 at 6:17

Allow uploads via flickr.py

This issue is designed to track the progress of an upload photos addition
to flickr.py

Currently in the SVN trunk, I have a file called flickrUpload.py from
earlier this year. I have decided that for uploading photos, a separate
file should be created for maintainability reasons. I got stuck working on
that file, which is why it hasn't been edited for over 4 months, but I do
plan to start working on it.

The aim is quite simple: allow developers to harness the full potential of
flickr.py and upload photos as well as view, download, and retrieve
information. I will post comments here with progress information.

Original issue reported on code.google.com by [email protected] on 16 Apr 2008 at 4:03

Fix crash in 1-photo photosets

Photoset.getPhotos() raises an exception if there is exactly one photo in the 
set:

Traceback (most recent call last):
  File "./test_api.py", line 33, in <module>
    test_photosets(stefano)
  File "./test_api.py", line 17, in test_photosets
    photos = photoset.getPhotos()
  File "/home/artur/devel/flickrpy-devel/flickr.py", line 412, in getPhotos
    for photo in photos:
TypeError: iteration over non-sequence

Attaching patch that fixes the issue.

Original issue reported on code.google.com by [email protected] on 5 Apr 2013 at 8:30

Attachments:

User attributes fail when null

What steps will reproduce the problem?
1.

(import module and set API key)

>>>foo = flickr.User('38892968@N00')
>>>foo.location

This user has no location, or various other things. The problem is that the
current code fetches attributes, but doesn't insert null values for the
parts of the tree which don't exist:

Traceback (innermost last):
  File "<stdin>", line 1, in <module>
  File "flickr.py", line 461, in <lambda>
    self.__photos_count = count
  File "flickr.py", line 476, in _general_getattr
    self._general_getattr('photos_count'))
  File "flickr.py", line 497, in _load_properties
    self.__ispro = person.ispro
AttributeError: Bag instance has no attribute 'realname'





Original issue reported on code.google.com by [email protected] on 31 Jul 2008 at 9:37

tag_mode does not work for photos_search

What steps will reproduce the problem?
1. Specify more than one tag in photos_search and set tag_mode='all'

What is the expected output? What do you see instead?

Expected: photos that contained all the tags.
Observed: photos that contain any of the tags.

What version of the product are you using? On what operating system?

Rev: 36

Please provide any additional information below.

The fix is to add tag_mode=tag_mode in the _doget() call within
photos_search() in flickr.py.  It'll be around line 619.

Original issue reported on code.google.com by [email protected] on 4 Aug 2008 at 12:12

flickr.urls.getUserPhotos method is missing

Hi,

First, I really enjoy Flickr.py ! Thanks for having it done !

However, it's a pity as it could be very usefull. Otherwise, I found
equivalent for all I used with phpFlickr ! :)

Do you plan to add it soon ?

Regards,
Nicolas

Original issue reported on code.google.com by [email protected] on 14 Apr 2007 at 3:34

flickr.py does not return number of

flickr.py does not return the number of pages or the total number of items
returned by a query... without that information I cannot tell when to stop
a loop that fetches a few of the photos at a time that matched a query.

  I would like to be able to query to following and know how many answers I
get:

flickr.photos.search
flickr.photosets.getPhotos
flickr.groups.pools.getPhotos


an example of the flickr response is :
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=xxx&tag
s=fairhope+alabama&tag_mode=all
<rsp stat="ok">
  <photos page="1" pages="3" perpage="100" total="296">

Problem program:

#!/usr/bin/env python
#

import sys
import flickr

per_page="100"
for page in range(1, 10):
  print "page: ", page
  photos = flickr.photos_search(tags="fairhope
alabama",per_page=per_page,page=page)
  print photos
  print "lendth: ", len(photos)



page:  1
[<flickr.Photo object at 0xb7a89b4c>, <flickr.Photo object at 0xb799e3ec>,
<flickr.Photo object at 0xb799e42c>, ...]
lendth:  100
page:  2
[<flickr.Photo object at 0xb79999ac>, <flickr.Photo object at 0xb7915cec>,
<flickr.Photo object at 0xb7915d2c>, ...]
lendth:  100
page:  3
[<flickr.Photo object at 0xb799e62c>, <flickr.Photo object at 0xb788482c>,
<flickr.Photo object at 0xb788486c>, ...]
lendth:  96
page:  4
Traceback (most recent call last):
  File "./test.py", line 10, in <module>
    photos = flickr.photos_search(tags="fairhope
alabama",per_page=per_page,page=page)
  File "/opt/flickr-pitchr/bin/flickr.py", line 604, in photos_search
    if isinstance(data.rsp.photos.photo, list):
AttributeError: Bag instance has no attribute 'photo'

Original issue reported on code.google.com by [email protected] on 21 Mar 2008 at 5:08

Add 'number of views' property to Photo

Via the flickr.photos.getInfo API request flickr sends the number of views as 
well (which could be useful feature).
It is a tiny enhancement, but nice to have feature.
In the attached diff there is the few line solution.

Original issue reported on code.google.com by [email protected] on 6 Jan 2014 at 8:26

Attachments:

Manage several connections

This is not an issue, but an enhancement.

I am starting to use this library and I would like to manage several
authenticated connections to flickr.

I think the key is to let developer choose the token used in requests. Now,
when a request is performed user can set the auth boolean to True, and
library gets token from a file:

    def _doget(method, auth=False, **params):

I propose this interface:

    def _doget(method, token=None, **params):

If token is None, request will be non-authenticated.

If token is not None, the request will be authenticated using the token
provided by user.

I do not know if this will provoke some side effect because I do not
control the library like you. It is only a proposal.

Original issue reported on code.google.com by [email protected] on 6 Jul 2008 at 4:39

i need support for geospatial searches for photos

I need support for lat lon, radius, has_geo in the search.

here is a patch that is backward and forward compatible for the features.  

example usage:
photos_search(lat=39.73,lon=-104.98,radius=5,tags=tags,has_geo=1, per_page=16)

Index: flickr.py
===================================================================
--- flickr.py   (revision 56)
+++ flickr.py   (working copy)
@@ -923,7 +923,7 @@
                   min_upload_date='', max_upload_date='',\
                   min_taken_date='', max_taken_date='', \
                   license='', per_page='', page='', sort='',\
-                  safe_search='', content_type='' ):
+                  safe_search='', content_type='', **kwargs):
     """Returns a list of Photo objects.

     If auth=True then will auth the user.  Can see private etc
@@ -938,7 +938,7 @@
                   license=license, per_page=per_page,\
                   page=page, sort=sort,  safe_search=safe_search, \
                   content_type=content_type, \
-                  tag_mode=tag_mode)
+                  tag_mode=tag_mode, **kwargs)
     photos = []
     if data.rsp.photos.__dict__.has_key('photo'):
         if isinstance(data.rsp.photos.photo, list):

Original issue reported on code.google.com by [email protected] on 1 Nov 2013 at 3:38

Attachments:

Photopage URL property for Photo instance

Flickr photos.getInfo API method now has xpath:photo/urls/url[@type = 
'photopage']/text() 
property with a link to default photo page on flickr, so the method 
Photo.getURL() with another 
request in it could be avoided.

I've fix my copy of flickr.py with next patch:
{{{
<flickr.py:64: 'permaddmeta']
>flickr.py:64: 'permaddmeta', 'url']
<flickr.py:71: isfavorite=None, server=None, license=None, rotation=None):
>flickr.py:71: isfavorite=None, server=None, license=None, rotation=None, 
url=None):
>flickr.py:97: self.__url = None
>flickr.py:155: self.__url = photo.urls.url.text
}}}

Thanks.



Original issue reported on code.google.com by [email protected] on 13 Dec 2008 at 9:03

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.