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

  • SEARCH
  • Home
  • 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 9205875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:03:50+00:00 2026-06-18T00:03:50+00:00

I am trying all of the following methods to get the push request information

  • 0

I am trying all of the following methods to get the push request information and they are all failing:

@app.route('/handlepush', methods=['POST'])
def handlepush():
    """
    Handles push notifications from Foursquare
    """
    print 'handling push'
    print request

    try:
        print 'request.form:' + json.loads(request.form['checkin'],
                          parse_float=str)
    except:
        print 'request.form error'

    try:
        print 'request.data: ' + json.loads(request.data['checkin'], parse_float=str)
    except:
        print 'no request.data'

    try:
        print 'request.form' + request.form
    except:
        print 'no request.form'

    try:
        print 'request.args' + request.args
    except:
        print 'no request.args'

    if request.headers['Content-Type'] == 'text/plain':
        print'text/plain'
        return "Text Message: " + request.data

    elif request.headers['Content-Type'] == 'application/json':
        print 'application/json'
        return "JSON Message: " + json.dumps(request.json)

    try:
        print 'request.form["id"]:' + request.form['checkin']['id']
    except:
        print 'request.form error'

    try:
        print request.data['checkin']['id']
    except:
        print 'request.data error'

    try:
        print 'request.json: ' + request.json
    except:
        print 'no request.json'


    return 'hi'

and this is my response:

2013-01-28T00:54:31+00:00 app[web.1]: <Request 'http://my.herokuapp.com/handlepush' [POST]>
2013-01-28T00:54:31+00:00 app[web.1]: handling push
2013-01-28T00:54:31+00:00 app[web.1]: no request.args
2013-01-28T00:54:31+00:00 app[web.1]: 10.71.26.114 - - [28/Jan/2013 00:54:31] "POST /handlepush HTTP/1.1" 200 -
2013-01-28T00:54:31+00:00 app[web.1]: request.form error
2013-01-28T00:54:31+00:00 app[web.1]: no request.data
2013-01-28T00:54:31+00:00 app[web.1]: no request.form
2013-01-28T00:54:31+00:00 app[web.1]: request.data error
2013-01-28T00:54:31+00:00 app[web.1]: no request.json
2013-01-28T00:54:31+00:00 app[web.1]: request.form error

So I was wondering the best way to approach this. request.json works for json POSTs in my experience when the header is specified as ‘application/json’, but I don’t know how to get this push data.

  • 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-06-18T00:03:51+00:00Added an answer on June 18, 2026 at 12:03 am
    request.form['checkin']
    

    did the trick and got me the json.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the following code to get all trace data for the
I was trying to get all the string properties and methods. And instead of
I am trying to find all the digits following a certain String pattern using
I am trying to install Googles' eclipse plugin - http://code.google.com/eclipse/docs/getting_started.html Even on following all
I am trying to check the following and all throw an out of bounds
I'm trying to select all text in-between following a specific pattern: Sample Text: by
I am trying to configure logback-classic to handle the following situation: All messages originating
I am trying to run the following to extract the text from all the
I'm trying to use the following code and it still strips out all the
All of a sudden I've been getting the following error when trying to do

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.