Giter Site home page Giter Site logo

Can't get work any methods about parsepy HOT 7 CLOSED

fuzunspm avatar fuzunspm commented on May 28, 2024
Can't get work any methods

from parsepy.

Comments (7)

dhaneshsabane avatar dhaneshsabane commented on May 28, 2024

I have been facing a similar issue with basic queries.

Here's what my function looks like:

def getTaskAppCount(Object):
    myClassName = "EarnNowTaskApplication"
    myClass = Object.factory(myClassName)
    all_scores = myClass.Query.all()
    print(type(all_scores))
    
    for score in all_scores:
        # do something
    
    return someValue

The function fails with:

if _is_illegal_header_value(values[i]):
TypeError: expected string or bytes-like object

What am I doing wrong?

from parsepy.

milesrichardson avatar milesrichardson commented on May 28, 2024

Hey guys @Dhanesh95 @fuzunspm

Sorry I've really dropped the ball on this project. I inherited it from the previous maintained because he didn't use it / have time for it anymore, and now I'm in the same position! Embarrassing, I'm sorry.

Since parse-server has been open sourced, there has been a lot of changes to it. It might make sense to start a fresh project targeting latest python3 / asyncio and the latest parse.

That said, I am unable to reproduce these bugs. I tried in both python3 (3.6) and python2. I'm running against parse-server 2.7.1.

Could you please put together a single file that reproduces the bug and paste it here? And let me know exactly which versions of Python and parse-server you are running.

Googling for this "is_illegal_header_value" turns up some other projects having issues with Python 3.5+ related to \n in header values: Evernote/evernote-sdk-python3#16 which stems from a fix to https://bugs.python.org/issue22928

But I don't see anywhere in this project that is inserting \n into header values (at least at a quick glance). And as I said I cannot reproduce this bug. Are you sure you are not including a newline somewhere? Perhaps in some of your environment variables used to configure parse?

from parsepy.

milesrichardson avatar milesrichardson commented on May 28, 2024

Are you running on windows?

from parsepy.

milesrichardson avatar milesrichardson commented on May 28, 2024

I tried reproducing this in a bunch of scenarios:

  • Python3 / Python2
  • Master key / logged in as user
  • GET queries
  • POST save objects
  • Proxy / no proxy

(One thing -- I am running parse_server behind nginx, and not so easy for me to change that in my current setup. Maybe this is the issue, idk.)

Unable to reproduce. Here is the code I'm using:

Logged in user:

import os
os.environ["PARSE_API_ROOT"] = "http://localhost:9595/api/parse"

from parse_rest.datatypes import Function, Object, GeoPoint, File
from parse_rest.connection import register
from parse_rest.query import QueryResourceDoesNotExist
from parse_rest.connection import ParseBatcher
from parse_rest.connection import SessionToken
from parse_rest.core import ResourceRequestBadRequest, ParseError
from parse_rest.user import User

from parse_rest.connection import SessionToken, register

from pprint import pprint

APPLICATION_ID = 'appID'
REST_API_KEY = 'restAPIKey'

register(APPLICATION_ID, REST_API_KEY)

class Fund(Object):
    pass

u = User.login('[email protected]', 'test')

print(u.sessionToken)

with SessionToken(u.sessionToken):
    funds = Fund.Query.all()
    for fund in funds:
        print(fund)

    fund2 = Fund(fundName='test name')
    fund2.save()

Master key:

import os
os.environ["PARSE_API_ROOT"] = "http://localhost:9595/api/parse"

from parse_rest.datatypes import Function, Object, GeoPoint, File
from parse_rest.connection import register
from parse_rest.query import QueryResourceDoesNotExist
from parse_rest.connection import ParseBatcher
from parse_rest.connection import SessionToken
from parse_rest.core import ResourceRequestBadRequest, ParseError
from parse_rest.user import User

from parse_rest.connection import SessionToken, register

from pprint import pprint

APPLICATION_ID = 'appID'
REST_API_KEY = 'restAPIKey'
MASTER_KEY = 'masterKey'

register(APPLICATION_ID, REST_API_KEY, master_key=MASTER_KEY)

class Fund(Object):
    pass

funds = Fund.Query.all()
for fund in funds:
    print(fund)

fund2 = Fund(fundName='test name')
fund2.save()

from parsepy.

milesrichardson avatar milesrichardson commented on May 28, 2024

Bunch more info here: https://www.google.com/search?q=%22_is_illegal_header_value%22

from parsepy.

dhaneshsabane avatar dhaneshsabane commented on May 28, 2024

@milesrichardson Thanks a ton for your quick response!

It works now. Turns out it was an incorrect environment variable. Sorry for the false alarm!

I was extremely happy to find out about this project today and I'm sorry to hear that you have dropped the ball. Thanks a lot for your efforts.

from parsepy.

milesrichardson avatar milesrichardson commented on May 28, 2024

It still works for 99% of use cases as far as I know. I wouldn't be scared to use it. I'm also happy to review any PRs for bugs you encounter. Just don't have time to add new features.

from parsepy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.