Categories
Mastering Development

How to update permissions in Google Drive API v3?

I uploaded a file using my service account, service account is the owner: {‘permissions’: [{‘deleted’: False, ‘displayName’: ‘My name’, ’emailAddress’: ‘myemail@gmail.com’, ‘id’: ‘00654354190098938408’, ‘kind’: ‘drive#permission’, ‘photoLink’: ‘https://lh6.googleusercontent.com/photo.jpg’, ‘role’: ‘writer’, ‘type’: ‘user’}, {‘deleted’: False, ‘displayName’: ‘myservice@myservice.iam.gserviceaccount.com’, ’emailAddress’: ‘myservice@myservice.iam.gserviceaccount.com’, ‘id’: ‘16815597635264162472’, ‘kind’: ‘drive#permission’, ‘role’: ‘owner’, ‘type’: ‘user’}]} Then I’m trying to change the role of myemail account […]

Categories
Mastering Development

How to get a display attribute and then alphabetically order all display atribute in an array of objects?

This is kinda hard to explain, but i will try. I have this array of objects, and i will receive an input name, like “Márcio Magalhães”. Then i need to find the “Marcio Magalhães” in the display attribute, catch and store the “display” and the “name” of the object AFTER him, like in this case […]

Categories
Mastering Development

Getting specific lines from a print in Python with Spotipy

I am writing some code with Python and Spotipy and I’m relatively new to coding. I have some code that get all the info about a Spotify playlist and prints it out for me: from spotipy.oauth2 import SpotifyClientCredentials import spotipy import json client_credentials_manager = SpotifyClientCredentials() sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager) playlist_id = ‘spotify:playlist:76CVeJDw2b90up5PgkZXyU’ results = sp.playlist(playlist_id) #print(json.dumps(results, […]

Categories
Mastering Development

WCF Webinvoke POST giving (400) Bad Request for specific server

Good morning/evening, I am new to WCF and have created a sample application. The problem is I am passing a json string as a request but getting 400:Bad request error. The details of my sample is given below: ISampleService.cs: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.ServiceModel; using System.ServiceModel.Web; […]

Categories
Development

How to handle error or exception on a Class (DriveApp)

Does anyone have a sample of code for I should use to handle an error thrown by the following call? Drive.Permissions.insert( { ‘role’: ‘reader’, ‘type’: ‘user’, ‘value’: ‘wxy@zzzzzzzz.com’ }, fileID, { ‘sendNotificationEmails’: ‘false’ }); In certain circumstances, I get the following error and would simply like to ignore and continue my script. Error is: API […]

Categories
Development

Adding permissions on Google Sheet doesn’t work despite 200 from API

I’m using a service account with a project that has both GoogleDrive and Google Sheets API enabled. I am trying to add permissions to an already existing Google Sheet (created by the same service account). The API is returning like it succeeds but the permissions remained unchanged. Client config: from googleapiclient.discovery import build from google.oauth2 […]

Categories
Development GitHub

Github action bot pushing to gh-pages causes page build to fail

I have a github repo where I have set up github actions to build the documentation automatically and push it to the gh-pages branch. Here is the full script, and everything goes find including pushing the update, which is done by the following 2 lines: git -c user.email=<hidden from question> -c user.name=”${GITHUB_ACTOR}” commit -m “Github […]

Categories
Development

How to debug a (PCRE) regex passed to grep?

I’m trying to debug a regex passed to grep that doesn’t seem to be working just on my system. This is the full command that should return the latest terraform release version: wget -qO – “https://api.github.com/repos/hashicorp/terraform/releases/latest” | grep -Po ‘”tag_name”: “v\K.*?(?=”)’ Which seems to be working for others but not me. Adding a * quantifier […]

Categories
Development

How to debug a (PCRE) regex passed to grep?

I’m trying to debug a regex passed to grep that doesn’t seem to be working just on my system. This is the full command that should return the latest terraform release version: wget -qO – “https://api.github.com/repos/hashicorp/terraform/releases/latest” | grep -Po ‘”tag_name”: “v\K.*?(?=”)’ Which seems to be working for others but not me. Adding a * quantifier […]

Categories
Development

Index & sort with newly introduced field

I have a document structure as below: { “_id”: “6ed3d427045228dce9e3b38d111cb046”, “_rev”: “1-952bddae5572fbf2b0ce4a165c19c98b”, “type”: “USER”, “name”: “ABC”, “email”: “abc@gmail.com”, “phone”: “024578963” } This is NodeJS app and I am using the couchdb-nano. For the sorting purpose (like getting data for Pagination), I have created an index for the above fields (name, email, phone). A new field […]