Categories
CMS Drupal Mastering Development

hook_menu_local_tasks_alter is not invoked during functional tests

I have an implementation of hook_menu_local_tasks_alter in my module, which works fine on my dev environment, but when I try to run my module using BrowserTestBase the hook is not invoked when visiting a node. Why? Here is a mock instance of the hook that I’ve set up just to see if the hook is […]

Categories
Mastering Development

Perserver cookies between request AXIOS (Node.js)

$ node -v v10.15.0 "axios": "^0.19.2", I am trying to keep cookies from response header field ‘set-cookie’ – just like browsers do. I used to use this module (https://www.npmjs.com/package/request ) and there was an option request.defaults({jar: true}) which worked well. For axios I reqd that {withCredentials: true} would do the job – but it DOESN’T. […]

Categories
Mastering Development

Reading data from MySQL and writing in GCP Bucket using Apache Beam Python API

I’m trying to read data from MySQL database (located in GCP) and writing the same in GCP Bucket. I want to use Python SDK for the same. Below is the code I’ve written. from __future__ import generators import apache_beam as beam import time import jaydebeapi import os import argparse from google.cloud import bigquery import logging […]

Categories
Mastering Development

Printing all pages after API request

I need’s some assistance to print all page number. In my example below, just my IDE console print page 1, how can I print all page: import json import pandas as pd import requests url=’https://unstats.un.org/SDGAPI/v1/sdg/Series/Data?seriesCode=SI_POV_DAY1&seriesCode=SI_POV_NAHC&seriesCode=SI_POV_EMP1_1524_TOT&seriesCode=SI_POV_EMP1_25UP_TOT&seriesCode=SN_ITK_DEFC&seriesCode=SH_STA_STNT&seriesCode=AG_PRD_ORTIND&seriesCode=DC_TOF_AGRL&seriesCode=SH_DYN_MORT&seriesCode=SH_STA_MORT&seriesCode=SH_STA_MALR1&seriesCode=SE_PRM_RDNG&seriesCode=SE_PRM_MATH&seriesCode=SE_PRM_GPITCH&seriesCode=DC_TOF_SCHIPSL&seriesCode=SP_DYN_MRBF18&seriesCode=SH_STA_FGMS&seriesCode=SG_GEN_PARL&seriesCode=SH_H2O_IMPR&seriesCode=SH_SAN_IMPR&seriesCode=ER_H2O_STRESS&seriesCode=DC_TOF_WASHL&seriesCode=EG_ELC_ACCS&seriesCode=EG_EGY_CLEAN&seriesCode=EG_FEC_RNEW&seriesCode=SL_TLF_15UP_UEM_TOT&seriesCode=SL_TLF_1524_UEM_TOT&seriesCode=SL_TLF_CHDLBR&seriesCode=SL_EMP_PCAP&seriesCode=DC_TOF_TRDCMDL&seriesCode=NV_IND_MANFPC&seriesCode=SL_TLF_MANF&seriesCode=GB_XPD_RSDV&seriesCode=DC_TOF_INFRAL&seriesCode=SL_EMP_GTOTL&seriesCode=DC_TRF_TOTDL&seriesCode=SI_RMT_COS&seriesCode=EN_LND_SLUM&seriesCode=EN_ATM_PM25&seriesCode=EN_DOMCMPC&seriesCode=EN_DOMCMPG&seriesCode=EN_MAT_DOMCMPT&seriesCode=ER_MRN_MPA&seriesCode=ER_PTD_MTN&seriesCode=ER_PTD_TERR&seriesCode=ER_RSK_LST&seriesCode=SG_REG_BRTH&seriesCode=VC_PRS_UNSEC&seriesCode=BX_TRF_PWKR&seriesCode=DT_TDS_DECT&seriesCode=SG_STT_CAPTY&seriesCode=IT_USE_ii99&areaCode=12&areaCode=24&areaCode=204&areaCode=72&areaCode=854&areaCode=108&areaCode=120&areaCode=132&areaCode=140&areaCode=148&areaCode=174&areaCode=178&areaCode=180&areaCode=384&areaCode=262&areaCode=818&areaCode=226&areaCode=232&areaCode=231&areaCode=266&areaCode=270&areaCode=288&areaCode=324&areaCode=624&areaCode=404&areaCode=426&areaCode=430&areaCode=434&areaCode=450&areaCode=454&areaCode=466&areaCode=478&areaCode=480&areaCode=504&areaCode=508&areaCode=516&areaCode=562&areaCode=566&areaCode=646&areaCode=678&areaCode=686&areaCode=690&areaCode=694&areaCode=706&areaCode=710&areaCode=728&areaCode=729&areaCode=748&areaCode=834&areaCode=768&areaCode=788&areaCode=800&areaCode=894&areaCode=716&timePeriod=%5B%221990%22%2C%222019%22%5D’ r=requests.get(url) headers={ "content-security-policy": "frame-src ‘self’ https://*.arcgis.com https://www.youtube.com https://youtube.com https://*.twitter.com https://fonts.googleapis.com https://maxcdn.bootstrapcdn.com https://flickrembed.com/ https://public.tableau.com", "content-type": "application/json; charset=utf-8", "date": "Tue, 30 Jun […]

Categories
Mastering Development

Python requests 401 Unauthorized

I’m trying to log in to a cloudflare server based website. I bypassed the login issues using cloudserver, but my next stop point has been when I tried to send a get request to have access to some post login tokens. My code: headers = { ‘authority’: ‘www.paf.es’, ‘accept’: ‘application/json, text/plain, */*’, ‘user-agent’: ‘Mozilla/5.0 (Windows […]

Categories
Mastering Development

Unable to set the STOP-LOSS limit order using Binance Python API

I am attempting to create a LONG TRADE that will contain a BUY ORDER and a STOP-LOSS using Python asyncio, ccxt API (which is calling the Binance API for the Binance Crypto Exchange). First I create the BUY ORDER. Afterwards, I am waiting until the order is filled. AFTER it is filled, I am attempting […]

Categories
Mastering Development

Rusoto streamed upload using sigv4

I’m having trouble streaming uploads to S3: // rust version 1.42.0 // OS macos // [dependencies] // rusoto_core = “0.43.0” // rusoto_s3 = “0.43.0” // log = “0.4” // pretty_env_logger = “0.4.0” // tokio = “0.2.14” // tokio-util = { version = “0.3.1”, features = [“codec”] } // futures = “0.3.4” // bytes = “0.5.4” […]

Categories
Mastering Development

Browser says access-control-allow-origin header not present in clojure ring

I make a request to a server through the client browser like so https://example.com/bar, but get the error: Access to XMLHttpRequest at ‘https://example.com/bar/’ from origin ‘https://www.example.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. However, when using clj-http.client, I get the following headers: {“Access-Control-Allow-Headers” “Content-Type”, “Server” “Aleph/0.4.4”, “Via” […]

Categories
Mastering Development System & Network

ERROR: (gcloud.app.deploy) UNAVAILABLE: The service is currently unavailable

Since last night App Engine has been throwing 503 errors for deploy, delete, and traffic migration requests. This is happening from both the CLI and the console. App Engine is still serving traffic, but it seems all the admin functions are not working. Others have reported this issue as well on the GCP Slack Error […]

Categories
Development

Flutter Format Exception when uploading multipart image to server with header and body fields?

I need to upload an image to server with header, body and token using http package. http.MultipartRequest imageUploadRequest = http.MultipartRequest(‘POST’, Uri.parse(BASE_URL)); imageUploadRequest.headers[“Authorization”] = “bearer ${token}”; imageUploadRequest.fields[‘FileName’] = “Test”; final file = await http.MultipartFile.fromPath(‘file’, image.path); imageUploadRequest.files.add(file); final streamedResponse = await imageUploadRequest.send(); print(“streamedResponse.statusCode : ${streamedResponse.statusCode}”); // Log-> streamedResponse.statusCode : 307 print(“streamedResponse.headers : ${streamedResponse.headers}”); // Log-> streamedResponse.headers : […]