Re: [bitly-api] MISSING_ARG_LOGIN with /v3/info request

162 views
Skip to first unread message

Jehiah Czebotar

unread,
Mar 20, 2013, 11:03:07 AM3/20/13
to bitl...@googlegroups.com
Hi.

It looks like have a typo in `self.endpoint` where you have a `/`
after the question mark.

Also, you shouldn't strip the bitly link to get the hash, use the full
link as the shortUrl argument. It's not clear to me, but you may be
putting the values in both the request body (ie: `params)` and in the
URL. You should only put them in the url.

`self.base_url + '/v3/info?' +
urllib.urlencode(dict=access_token=self.access_token
shortUrl=shortUrl)`

--
Jehiah

--
Jehiah


On Wed, Mar 20, 2013 at 8:16 AM, <bentba...@gmail.com> wrote:
> Heya,
>
> How do I deal with this error: MISSING_ARG_LOGIN ? I am a real beginner with
> scripting and the like, but I have a python script that connects, and gets
> link_history, user_network_history, and user_info successfully.
>
> But now I have added a method to get info from /v3/info, I can't figure out
> why the call doesn't work.
>
> The method looks like this:
>
>>> def link_info(self, bithash, shortUrl):
>>>
>>> 39 if shortUrl == None or bithash == None:
>>>
>>> 40 return "Must supply bit.ly hash & shortUrl to call
>>> link_info"
>>>
>>> 41 request_string = "&shortUrl=http%3A%2F%2Fbit.ly%2F"
>>>
>>> 42 payload = dict()
>>>
>>> 43 payload["hash"] = bithash
>>>
>>> 44 payload["shortUrl"] = shortUrl
>>>
>>> 45 self.endpoint = "/v3/info?/access_token="
>>>
>>> 46 data = requests.get(self.base_url + self.endpoint +
>>> self.access_token + request_string + bithash, params=payload)
>>>
>>> 47 return data
>
>
> So I get my bit.ly link from my link_history method, strip it for the hash
> and then call this link_info method. All I seem to get is MISSING_ARG_LOGIN
>
> What am I doing wrong here?
>
> Cheers!
>
>
>
> --
> --
> You are subscribed to the bit.ly API discussion group.
> To post, email to bitl...@googlegroups.com
> For more options, visit http://groups.google.com/group/bitly-api
>
> ---
> You received this message because you are subscribed to the Google Groups
> "bitly API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bitly-api+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Matt LeMay

unread,
Mar 20, 2013, 11:02:42 AM3/20/13
to bitl...@googlegroups.com
Hello!

A couple changes I'd suggest here:

 45         self.endpoint = "/v3/info?/access_token="

Should read "/v3/info?access_token=" (omit the slash)

Also, the /v3/info endpoint requires either a hash *OR* a shortUrl but will fail if you actually provide both. In this case, it looks like you could omit the shortUrl parameter.

Hope this helps!

Thanks, and all the best,
Matt

Message has been deleted

bentba...@gmail.com

unread,
Mar 20, 2013, 7:12:11 PM3/20/13
to bitl...@googlegroups.com
Thanks to you both! You were both spot on. And I really shouldnt do this kinda thing when I'm knackered! 

Thanks for taking the time to read and respond


Amended function now working ok! :

         def link_info(self, shortUrl):
 39         if shortUrl == None:    
 40             return "Must supply bit.ly shortUrl"
 41         payload = dict()
 42         payload["shortUrl"] = shortUrl
 43         self.endpoint = "/v3/info?access_token="
 44         data = requests.get(self.base_url + self.endpoint + self.access_token, params=payload)
 45         return data 

 
Reply all
Reply to author
Forward
0 new messages