开发者

Authenticated request in Google App Engine using fetch() function: how to provide the information in the header of the request? [closed]

开发者 https://www.devze.com 2022-12-14 07:24 出处:网络
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code nece
Closed. This question needs debugging details. It is not currently accepting answers.

Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.

Closed 3 years ago.

Improve this question

I am trying to pass automatically, using Google App Engine, my password and ID to eBay, to this page:

https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=0&ru=http%3A%2F%2Fcgi5.ebay.com%2Fws2%2FeBayISAPI.dll%3FSellItem%26hm%3Dum.rundkoi376%26%26hc%3D1%26guest%3D1&pageType=1144

(It is where I get redirected to from this URL: https://signin.ebay.com). Here is how the page looks like:

Authenticated request in Google App Engine using fetch() function: how to provide the information in the header of the request? [closed]

(source: narod.ru)

Earlier I have asked some questions, and here one very nice supporter suggested that I use code from this link: http://chillorb.com/?p=195 If you have no time to go there, here is how that page looks like:

Authenticated request in Google App Engine using fetch() function: how to provide the information in the header of the request? [closed]

(source: narod.ru)

So, I pasted that code into my editor substituting the valid eBay URL, my ID and password. My ID there is seeyousoondanny and the password is happy1 (I created that account on eBay just for experimenting, so I am not afraid to give out my ID and password). Here is how the code looked in my editor:

Authenticated request in Google App Engine using fetch() function: how to provide the information in the header of the request? [closed]

(source: narod.ru)

But when I run this code I get only this:

Authenticated request in Google App Engine using fetch() function: how to provide the information in the header of the request? [closed]

(source: narod.ru)

What am I doing wrong here?

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Addition:

Here开发者_StackOverflow社区 is the bottom of the error page (I think it will be seen clearer if you click on the link to this image):

Authenticated request in Google App Engine using fetch() function: how to provide the information in the header of the request? [closed]

+++++++++++++++++++++++++++++++++++++++++++++++++++

Addition:

I guess this code has no syntax mistakes:

from google.appengine.api import urlfetch
import base64

url = "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=0&ru=http%3A%2F%2Fcgi5.ebay.com%2Fws2%2FeBayISAPI.dll%3FSellItem%26hm%3Dum.rundkoi376%26%26hc%3D1%26guest%3D1&pageType=1144"
authString = 'Basic' + base64.encodestring('seeyousoondanny:happy1')
data = urlfetch.fetch(url, headers= {'AUTHORIZATION' : authString })
if data.status_code == 200:
   print "content-type: text/plain"
   print
   print data.status_code


I'm not sure if this helps, but ebay has an API that would be simpler to use and incorporate. Check out http://developer.ebay.com/businessbenefits/aboutus/


Looks like some of the quote-characters are the wrong kind -- reversed "smart quotes" rather than normal plain ordinary ASCII quote characters. Hard to say precisely from screenshots! The error screen you're showing (from GAE's SDK) shows the exact location of the error at the very bottom -- and you're showing it scrolled all the way to the very top, so it doesn't help.

In GAE like in any other use of Python quote is done via plain single and double quote characters: ' and " ; not via slanted, inverted, or "smart" quote characters, such as

`

(hard to clearly show the inverted single quote in SO except as a codeblock, since it's used to mark inline code;-) or , , , and so forth. So check your code carefully to make sure you're using the normal, plain kinds of quotes!

0

精彩评论

暂无评论...
验证码 换一张
取 消