SACRAMENTO, Calif. — At first, Illinois Gov. J.B. Pritzker tried to play nice. He limited criticisms of the federal government’s handling of the coronavirus pandemic and asked for medical supplies through official channels.

But nothing came, so he went on television. The first-term Democrat blasted the Trump administration on Sunday on CNN for failing to help states obtain masks, gloves and other protective gear.

It got President Donald Trump’s attention. After a Twitter feud and some mudslinging (Pritzker compared Trump to a “carnival barker”), the two got on the phone Monday, and Trump promised Illinois 250,000 masks and 300 ventilators.

Facing an unprecedented public health crisis, governors are trying to get what they need from Washington, and fast. But often that means navigating the disorienting politics of dealing with Trump, an unpredictable president with a love for cable news and a penchant for retribution.

Republicans and Democrats alike are testing whether to fight or flatter, whether to back channel requests or go public, all in an attempt to get Trump’s attention and his assurances.

At stake may be access to masks, ventilators and other personal protective gear critically needed by health care workers, as well as field hospitals and federal cash. As Gov. Gretchen Whitmer, D-Mich., put it: “I can’t afford to have a fight with the White House.”

Underlying this political dance is Trump’s tendency to talk about the government as though it’s his own private business. The former real estate mogul often discusses government business like a transaction dependent on relationships or personal advantage, rather than a national obligation.

“We are doing very well with, I think, almost all of the governors, for the most part,” he said during a town hall on Fox News on Tuesday. “But you know, it’s a two-way street. They have to treat us well.”

Such statements have some governors treading lightly. In a twist, some of the more flattering governors are Democrats.

Perhaps no governor’s approach is more uncharacteristic than that of California’s Gavin Newsom, a Democrat whose state calls itself the “resistance” to Trump. Newsom, usually a fierce Trump critic, has gone out of way not to lay the federal government’s failings during the coronavirus outbreak at Trump’s feet.

Newsom complimented Trump for “his focus on treatments” for the virus and thanked him for sending masks and gloves to California. He said the president was “on top of it” when it came to improving testing and said Trump was aware “even before I offered my own insight” of the state’s need for more testing swabs.