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

HTTP Error 500: Internal Server Error. During uploading data #19

Open
GoogleCodeExporter opened this issue Jan 11, 2016 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

1. Run the following python code:

email = "correct email"
password = "correct password"

data = {'bug': [{'projectId': 'v100',
                  'title': 'test bug title',
                  'bugId': "333",
                  'path': '/1/3/3',
                  'severity': '1',
                  'priority': '2',
                  'groups': 'one',
                  'status': 'open',
                  'statusDate': '01/01/2013'
                 }],
         'test': [{'projectId': 'v100',
                 'testId': '1234',
                 'title': 'switching sources',
                 'tags': 'no',
                 'result': 'failed',
                 'resultDate': '01/01/2013'
                 }],
         'checkin': [{'projectId': 'v100',
                    'checkinId': '566',
                    'summary': "test summary",
                    'directories': '/home/users',
                    'state': 'committed',
                    'stateDate': '01/01/2013'
                    }]
        }

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(), 
urllib2.HTTPSHandler)
urllib2.install_opener(opener)

# Define URLs
loing_page_url = 'https://accounts.google.com/ServiceLogin'
gv_home_page_url = "https://test-analytics.appspot.com/api/data"

# Load sign in page
login_page_contents = opener.open(loing_page_url).read()

# Find GALX value
galx_match_obj = re.search(r'name="GALX"\s*value="([^"]+)"', 
login_page_contents, re.IGNORECASE)

galx_value = galx_match_obj.group(1) if galx_match_obj.group(1) is not None 
else ''

# Set up login credentials
login_params = urllib.urlencode({'Email': email,
                                 'Passwd': password,
                                 'GALX': galx_value
                                })

# Login
opener.open(loing_page_url, login_params)

# Open GV home page
# gv_home_page_contents = opener.open(gv_home_page_url).read()

# print gv_home_page_contents

req = urllib2.Request(url, json.dumps(data), headers)
print opener.open(req).read()

Actual result:
the following error appears:
Traceback (most recent call last):
  File "/home/...../src/test2.py", line 333, in <module>
    print opener.open(req).read()
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 625, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 625, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 625, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 625, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 625, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 444, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error


Original issue reported on code.google.com by [email protected] on 2 Sep 2013 at 12:54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant