Coder Social home page Coder Social logo

Comments (5)

robin900 avatar robin900 commented on May 26, 2024

Do you need the api response captured at runtime, or do you just need to see the response json as a log message? Because the response json is logged to the logger named gspread_dataframe at level DEBUG; set the logging level to DEBUG for the logger name or all loggers, and you will see the response json in the log output.

If you want the api response returned at runtime, tell me more about why you'd want it, and we can consider whether to change set_with_dataframe to return the api response object...

from gspread-dataframe.

robin900 avatar robin900 commented on May 26, 2024

@franciscothebrady An example debug log message from set_with_dataframe shows what the API response json would contain:

{
  'spreadsheetId': '1P3rdCCxfO760TJdE-cbi0k_yy9vmC-joapjuGw9vNjc', 
  'updatedRange': 'wksht_int_test!A1:T20', 
  'updatedRows': 20, 
  'updatedColumns': 20,
  'updatedCells': 400
}

If you just want to see this in your logs, enable logging at level DEBUG either throughout your program or for the logger logging.getLogger('gspread_dataframe') and all of its relevant handlers. (Configuring DEBUG-level logging in Python can be tricky; let me know if I can help.)

But if you really need the API response to be returned by set_with_dataframe so that you have it at runtime, please, tell me more.

from gspread-dataframe.

franciscothebrady avatar franciscothebrady commented on May 26, 2024

I literally just finished adding a logfile and some setup for this. I appreciate the added context and info about the logging.getLogger(). I'm running now and will update with results.

The context here is that I'm running this weekly to update some data for dashboards, and I want confirmation that the dataframe being pushed to gdrive is complete. These aren't huge sheets (2 - <10k rows), so I shouldn't be running up against any limits, but last week we had some odd results and it looks like one sheet wasn't completely updated. It sounds like if the full API response is returned that will confirm at least updatedRows, which might be enough. Thanks for you help.

from gspread-dataframe.

robin900 avatar robin900 commented on May 26, 2024

In my experience, the Sheets API is well-behaved around updates and error reporting. Either your cell updates to a worksheet succeed completely, or the API responds with a 4xx or 5xx status code and your Python API client raises an exception. If you are seeing "incomplete updates" to a worksheet without an exception raised by set_with_dataframe, I would be shocked if the cause lies somewhere in gspread_dataframe or the Sheets API.

Let me know how this resolves for you; I'll keep the issue open in the meantime.

from gspread-dataframe.

franciscothebrady avatar franciscothebrady commented on May 26, 2024

I think the log file is showing everything I needed. 200's all the way through. I'm leaning toward this being a further upstream issue, but I think I do need to build in some kind of exception handling if the API response isn't 200. I'm not a python expert yet. I think closing this issue for now is fine.

from gspread-dataframe.

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.