Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:44:51+00:00 2026-05-27T21:44:51+00:00

I’m trying to make Paypal’s sandbox API work and I’m using a sample project

  • 0

I’m trying to make Paypal’s sandbox API work and I’m using a sample project and the error I get is

 response was: {"responseEnvelope":{"timestamp":"2011-12-26T12:35:19.560-08:00","ack":"Success","correlationId":"ea7c82ca4d096","build":"2279004"},"payKey":"AP-53K115241G5252300","paymentExecStatus":"CREATED"}
headers must be str
Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1522, in __call__
    return response(environ, start_response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webob-1.1.1/webob/response.py", line 939, in __call__
    start_response(self.status, headerlist)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 129, in _StartResponse
    raise InvalidResponseError('headers must be str')
InvalidResponseError: headers must be str

Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 174, in Handle
    result = handler(self._environ, self._StartResponse)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1524, in __call__
    return self._internal_error(e)(environ, start_response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1522, in __call__
    return response(environ, start_response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webob-1.1.1/webob/response.py", line 939, in __call__
    start_response(self.status, headerlist)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 129, in _StartResponse
    raise InvalidResponseError('headers must be str')
InvalidResponseError: headers must be str

On production it’s the same error:

response was: {"responseEnvelope":{"timestamp":"2011-12-26T13:18:13.932-08:00","ack":"Success","correlationId":"d84672a2d6b1e","build":"2279004"},"payKey":"AP-2GA190885R390622U","paymentExecStatus":"CREATED"}
headers must be str
Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1522, in __call__
    return response(environ, start_response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webob-1.1.1/webob/response.py", line 939, in __call__
    start_response(self.status, headerlist)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 129, in _StartResponse
    raise InvalidResponseError('headers must be str')
InvalidResponseError: headers must be str

Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 174, in Handle
    result = handler(self._environ, self._StartResponse)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1524, in __call__
    return self._internal_error(e)(environ, start_response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1522, in __call__
    return response(environ, start_response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webob-1.1.1/webob/response.py", line 939, in __call__
    start_response(self.status, headerlist)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 129, in _StartResponse
    raise InvalidResponseError('headers must be str')
InvalidResponseError: headers must be str

The code that is trying to get run is

self.raw_response = url_request( "%s%s" % ( settings.PAYPAL_ENDPOINT, "Pay" ), data=self.raw_request, headers=headers ).content() 
logging.info( "response was: %s" % self.raw_response )
self.response = json.loads( self.raw_response )

I’m trying to run the code from an example at github. Is that probably something with my settings? I tried a signature both ending with a dot and one with not ending with a dot and it was the same result: The above error message. Could you recommend me what I should do?

Update

The problem is almost certainly due to upgrading from python 2.5 to 2.7 since the problem goes away if I downgrade. I can log the headers and they do seem like they are strings:

INFO     2011-12-31 08:43:03,286 paypal.py:143] headers: {'X-PAYPAL-REQUEST-DATA-FORMAT': 'JSON', 'X-PAYPAL-SECURITY-PASSWORD': '1425859477', 'X-PAYPAL-RESPONSE-DATA-FORMAT': 'JSON', 'X-PAYPAL-SECURITY-SIGNATURE': 'Al6H4Bq5kp4bKF5tyfR-p2FlAbpY5JFKl54FMzHpo.QKYew5obtYPIm.', 'X-PAYPAL-SECURITY-USERID': 'niklas_1364582637_biz_api1.eddaconsult.se', 'X-PAYPAL-DEVICE-IPADDRESS': '127.0.0.1', 'X-PAYPAL-APPLICATION-ID': 'APP-80W284485P519543T'}
INFO     2011-12-31 08:43:04,909 paypal.py:57] response was: {"responseEnvelope":{"timestamp":"2011-12-31T00:43:06.083-08:00","ack":"Success","correlationId":"bf0c9db7a13cb","build":"2279004"},"payKey":"AP-25U92494YK276842W","paymentExecStatus":"CREATED"}
ERROR    2011-12-31 08:43:04,925 webapp2.py:1528] headers must be str

When I use tcpdump there is nothing special in the log:

$ sudo tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
18:38:31.988690 IP6 fe80::914b:d0c9:3c27:919e.52450 > ff02::c.1900: UDP, length 146
18:38:31.989603 IP ubuntu.local.49948 > resolver1.comhem.se.domain: 9999+ PTR? c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa. (90)
18:38:31.989914 ARP, Request who-has OM-DOC-1-Bu30.comhem.se tell c213-89-134-0.bredband.comhem.se, length 46
18:38:32.006004 IP resolver1.comhem.se.domain > ubuntu.local.49948: 9999 NXDomain 0/1/0 (160)
18:38:32.006401 IP ubuntu.local.57850 > resolver1.comhem.se.domain: 20237+ PTR? e.9.1.9.7.2.c.3.9.c.0.d.b.4.1.9.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. (90)
18:38:32.017844 IP resolver1.comhem.se.domain > ubuntu.local.57850: 20237 NXDomain* 0/1/0 (125)
18:38:32.018075 IP ubuntu.local.51652 > resolver1.comhem.se.domain: 5935+ PTR? 11.245.255.83.in-addr.arpa. (44)
18:38:32.027394 IP resolver1.comhem.se.domain > ubuntu.local.51652: 5935 1/3/3 PTR resolver1.comhem.se. (186)
18:38:32.027530 IP ubuntu.local.35513 > resolver1.comhem.se.domain: 34706+ PTR? 10.0.168.192.in-addr.arpa. (43)
18:38:32.037746 IP resolver1.comhem.se.domain > ubuntu.local.35513: 34706 NXDomain 0/1/0 (120)
18:38:32.138234 IP6 fe80::219:b9ff:fe06:928e.mdns > ff02::fb.mdns: 0 PTR (QM)? 10.0.168.192.in-addr.arpa. (43)
18:38:32.138273 IP ubuntu.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 10.0.168.192.in-addr.arpa. (43)
18:38:32.138349 IP ubuntu.local.mdns > 224.0.0.251.mdns: 0*- [0q] 1/0/0 (Cache flush) PTR ubuntu.local. (63)
18:38:32.138675 IP ubuntu.local.50349 > resolver1.comhem.se.domain: 36768+ PTR? 1.128.89.213.in-addr.arpa. (43)
18:38:32.165618 IP resolver1.comhem.se.domain > ubuntu.local.50349: 36768 1/3/3 PTR OM-DOC-1-Bu30.comhem.se. (189)
18:38:32.165826 IP ubuntu.local.39699 > resolver1.comhem.se.domain: 32574+ PTR? 0.134.89.213.in-addr.arpa. (43)
18:38:32.174200 IP resolver1.comhem.se.domain > ubuntu.local.39699: 32574 1/3/3 PTR c213-89-134-0.bredband.comhem.se. (198)
18:38:32.174493 IP ubuntu.local.58622 > resolver1.comhem.se.domain: 34645+ PTR? b.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa. (90)
18:38:32.236655 IP resolver1.comhem.se.domain > ubuntu.local.58622: 34645 NXDomain 0/1/0 (160)
18:38:32.236852 IP ubuntu.local.52609 > resolver1.comhem.se.domain: 3885+ PTR? e.8.2.9.6.0.e.f.f.f.9.b.9.1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. (90)
18:38:32.245937 IP resolver1.comhem.se.domain > ubuntu.local.52609: 3885 NXDomain* 0/1/0 (125)
18:38:32.246143 IP ubuntu.local.43779 > resolver1.comhem.se.domain: 20440+ PTR? 251.0.0.224.in-addr.arpa. (42)
18:38:32.257346 IP resolver1.comhem.se.domain > ubuntu.local.43779: 20440 NXDomain 0/1/0 (99)
18:38:32.357753 IP6 fe80::219:b9ff:fe06:928e.mdns > ff02::fb.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42)
18:38:32.357798 IP ubuntu.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42)
18:38:32.474703 IP 192.168.0.11.6646 > 192.168.0.255.6646: UDP, length 170
18:38:32.475021 IP 192.168.0.11.51530 > ubuntu.local.netbios-ssn: Flags [S], seq 88766685, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:32.475035 IP ubuntu.local.netbios-ssn > 192.168.0.11.51530: Flags [R.], seq 0, ack 88766686, win 0, length 0
18:38:32.971416 IP 192.168.0.11.51530 > ubuntu.local.netbios-ssn: Flags [S], seq 88766685, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
18:38:32.971436 IP ubuntu.local.netbios-ssn > 192.168.0.11.51530: Flags [R.], seq 0, ack 1, win 0, length 0
18:38:33.358818 IP6 fe80::219:b9ff:fe06:928e.mdns > ff02::fb.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42)
18:38:33.358856 IP ubuntu.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42)
18:38:33.471329 IP 192.168.0.11.51530 > ubuntu.local.netbios-ssn: Flags [S], seq 88766685, win 8192, options [mss 1460,nop,nop,sackOK], length 0
18:38:33.471347 IP ubuntu.local.netbios-ssn > 192.168.0.11.51530: Flags [R.], seq 0, ack 1, win 0, length 0
18:38:33.481836 IP 192.168.0.11.51377 > ubuntu.local.1900: UDP, length 97
18:38:33.481853 IP ubuntu.local > 192.168.0.11: ICMP ubuntu.local udp port 1900 unreachable, length 133
18:38:33.482624 IP 192.168.0.11.51378 > 224.0.0.251.mdns: 0 [7q] PTR (QM)? _pdl-datastream._tcp.local. PTR (QM)? _printer._tcp.local. PTR (QM)? _ipp._tcp.local. PTR (QM)? _http._tcp.local. PTR (QM)? _workstation._tcp.local. PTR (QM)? _eppc._tcp.local. PTR (QM)? _net-assistant._tcp.local. (198)
18:38:33.482773 IP ubuntu.local.mdns > 192.168.0.11.51378: 0*- [7q],,,,,, 5/0/0 PTR ubuntu [00:19:b9:06:92:8e]._workstation._tcp.local., TXT "", SRV ubuntu.local.:9 0 0, AAAA fe80::219:b9ff:fe06:928e, A 192.168.0.10 (259)
18:38:34.988668 IP6 fe80::914b:d0c9:3c27:919e.52450 > ff02::c.1900: UDP, length 146
18:38:35.360953 IP6 fe80::219:b9ff:fe06:928e.mdns > ff02::fb.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42)
18:38:35.360996 IP ubuntu.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42)
18:38:36.751649 IP ubuntu.local.50394 > www-17-02-ash3.facebook.com.www: Flags [F.], seq 3090446013, ack 1136569104, win 130, options [nop,nop,TS val 12239647 ecr 2503075665], length 0
18:38:37.258743 IP ubuntu.local.49776 > resolver1.comhem.se.domain: 55236+ PTR? 255.0.168.192.in-addr.arpa. (44)
18:38:37.270032 IP resolver1.comhem.se.domain > ubuntu.local.49776: 55236 NXDomain 0/1/0 (121)
18:38:37.370372 IP6 fe80::219:b9ff:fe06:928e.mdns > ff02::fb.mdns: 0 PTR (QM)? 255.0.168.192.in-addr.arpa. (44)
18:38:37.370416 IP ubuntu.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 255.0.168.192.in-addr.arpa. (44)
18:38:37.918371 IP ubuntu.local.51337 > stackoverflow.com.www: Flags [F.], seq 3843139898, ack 3903597436, win 273, options [nop,nop,TS val 12239764 ecr 81335008], length 0
18:38:37.978365 ARP, Request who-has 192.168.0.11 tell ubuntu.local, length 28
18:38:37.978650 ARP, Reply 192.168.0.11 is-at f0:bf:97:5a:59:c7 (oui Unknown), length 46
18:38:37.988729 IP6 fe80::914b:d0c9:3c27:919e.52450 > ff02::c.1900: UDP, length 146
18:38:38.347231 IP stackoverflow.com.www > ubuntu.local.51355: Flags [F.], seq 439312178, ack 401000312, win 16, options [nop,nop,TS val 81340163 ecr 12238306], length 0
18:38:38.371686 IP6 fe80::219:b9ff:fe06:928e.mdns > ff02::fb.mdns: 0 PTR (QM)? 255.0.168.192.in-addr.arpa. (44)
18:38:38.371737 IP ubuntu.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 255.0.168.192.in-addr.arpa. (44)
18:38:38.378349 IP ubuntu.local.51355 > stackoverflow.com.www: Flags [.], ack 1, win 123, options [nop,nop,TS val 12239810 ecr 81340163], length 0
18:38:38.941011 IP ubuntu.local.50416 > www-17-02-ash3.facebook.com.www: Flags [S], seq 653211239, win 14600, options [mss 1460,sackOK,TS val 12239866 ecr 0,nop,wscale 7], length 0
18:38:39.057758 IP www-17-02-ash3.facebook.com.www > ubuntu.local.50416: Flags [S.], seq 1083765460, ack 653211240, win 4380, options [mss 1460,nop,wscale 0,nop,nop,TS val 2503201763 ecr 12239866,sackOK,eol], length 0
18:38:47.283299 IP ubuntu.local.55413 > resolver1.comhem.se.domain: 22287+ PTR? 54.242.171.69.in-addr.arpa. (44)
18:38:47.291897 IP resolver1.comhem.se.domain > ubuntu.local.55413: 22287 1/3/0 PTR www-17-02-ash3.facebook.com. (139)
18:38:47.292194 IP ubuntu.local.58277 > resolver1.comhem.se.domain: 55103+ PTR? 12.119.34.64.in-addr.arpa. (43)
18:38:47.301399 IP resolver1.comhem.se.domain > ubuntu.local.58277: 55103 1/2/0 PTR stackoverflow.com. (119)
18:38:47.989062 IP6 fe80::914b:d0c9:3c27:919e.52450 > ff02::c.1900: UDP, length 146
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:44:52+00:00Added an answer on May 27, 2026 at 9:44 pm

    I believe you’re running into a bug/feature of webapp2.

    redirect() will not accept unicode it must be a str.

    Try changing line main.py #91 to:

      self.redirect( pay.next_url().encode('ascii') ) # go to paypal
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.