Error when: createFriendship (Only unicode objects are escapable.) #121
Labels
No labels
Bug
Enhancement
Feature Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: code/twython#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I get a strange error when i try to add a follow:
twitter.createFriendship(id=task['target'],follow=True)
errorHandler: Unmanaged error detected when Following: XXXX: Only unicode objects are escapable.
XXXX is the twitter id of the user (a long), contained in task['target'], so... no unicode posible :¿
I check is on createFriendShip, when i do the oauth, i get no error.
I'm absolutely lost... any help will be appreciated:
Additional info (tell me if need more)
Python 2.7.3
twython-2.4.0.tar.gz
Ubuntu 12.04.1 LTS
Try:
Keyword arg
user_idinstead of justidSame result ;(
Also tried:
sc='ValidOne'
twitter.createFriendship(screen_name=sc,follow=True)
twitter.createFriendship(screen_name=sc.encode('UTF-8'),follow=True)
And i keep getting the "Only unicode objects are escapable." error
Really confusing for me.
Another try, I guess he expects for an unicode value, so, i ensure:
twitter.createFriendship(user_id=unicode(str(task['target'])),follow=True)
But, no luck...
Can you provide the full stack trace please?
Alright, don't worry about providing the stack trace. The issue comes where
follow=True.requestsdoesn't like that. I'm working on a fix now.Alright, got it.
You need to do this:
requestsdoesn't like items that can't be converted to unicode and rightfully so.So just pass
Trueas a string instead. I just ran the code and it works for me: Follows the target user and turns on mobile notifications. However note: That the authenticated user MUST have a phone number associated with the account or else notifications will not be turned on. The friendship will still be created, they just won't receive notifications because well... they can't. Haha.@ryanmcgrath You can close this. :)
Great!! thanks a lot...