Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argument 'safe' is not recognized by urlencode from urllib with python 2.7 #65

Closed
traut opened this issue Mar 22, 2012 · 5 comments
Closed

Comments

@traut
Copy link

traut commented Mar 22, 2012

I was trying to use the latest version from the trunk and I've got this exception:

 File "/Users/andrew/appwiser/appwiser/p27/src/twitter/twitter/api.py", line 159, in call
   arg_data = self.auth.encode_params(uriBase, method, kwargs)
 File "/Users/andrew/appwiser/appwiser/p27/src/twitter/twitter/oauth.py", line 105, in encode_params
   enc_params = urlencode_noplus(sorted(params.items()))
 File "/Users/andrew/appwiser/appwiser/p27/src/twitter/twitter/oauth.py", line 132, in urlencode_noplus
   return urlencode(query, safe='~').replace("+", "%20")
TypeError: urlencode() got an unexpected keyword argument 'safe'

I'm using python 2.7 and twitter/oauth.py imports urlencode from urllib. This urlencode does not support 'safe' argument

@giorkosman
Copy link

I had the same error today and i solved it by removing the setup-tools module and reinstalling it
Instead of doing apt-get setup-tools download from source and install it
I used 0.6c11
:)
Hope that's a fix for you as well (I actually registered just to give you an answer)

@traut
Copy link
Author

traut commented Mar 29, 2012

@giorkosman thank you, I'm going to try that

@itmarkerz
Copy link

i am also getting the same error,i am using a windows machine, what should i do ?

@giorkosman
Copy link

How did you install the module ?
On my windows machine i use Active State Python which comes with an installation module named easy_install
So in cmd type easy_install twitter. Try this and tell me (You can install easy install with any python you have)

@itmarkerz
Copy link

Hi there! We're gonna get you all set up to use sampleforminging.

Traceback (most recent call last):
File "C:\py.PY", line 39, in
oauth_login(APP_NAME, CONSUMER_KEY, CONSUMER_SECRET)
File "C:\py.PY", line 17, in oauth_login
consumer_secret)
File "build\bdist.win-amd64\egg\twitter\oauth_dance.py", line 35, in oauth_dance
twitter.oauth.request_token())
File "build\bdist.win-amd64\egg\twitter\api.py", line 159, in call
arg_data = self.auth.encode_params(uriBase, method, kwargs)
File "build\bdist.win-amd64\egg\twitter\oauth.py", line 105, in encode_params
enc_params = urlencode_noplus(sorted(params.items()))
File "build\bdist.win-amd64\egg\twitter\oauth.py", line 132, in urlencode_noplus
return urlencode(query, safe='~').replace("+", "%20")
TypeError: urlencode() got an unexpected keyword argument 'safe'

i get the same error...

My Code : https://github.com/itmarkerz/Recipes-for-Mining-Twitter/blob/master/recipe__oauth_login.py

ptwobrussell pushed a commit to ptwobrussell/twitter that referenced this issue Apr 6, 2012
…d by urlencode from urllib with python 2.7)
sixohsix added a commit that referenced this issue Apr 6, 2012
Fixes Issue #65, but regresses the tilde bug. Need to fix this later.
@sixohsix sixohsix closed this as completed Apr 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants