"ValueError: Fernet key must be 32 url-safe base64-encoded bytes." When converting str to fernet key

Advertisements I’m trying to convert a raw string password into a fernet key. This code doesn’t work: # Convert the string to bytes key_bytes = self.PrintPassword.encode() # Base64 encode the bytes base64_encoded_key = base64.urlsafe_b64encode(key_bytes) # Create a Fernet key using the encoded bytes fernet_key = base64.urlsafe_b64decode(base64_encoded_key) self. Fern = Fernet(fernet_key) >Solution : Your string should… Read More "ValueError: Fernet key must be 32 url-safe base64-encoded bytes." When converting str to fernet key

Laravel Getting id's from a table and inserting them into another table

Advertisements Trying to get matching id’s from a table and inserting them again in the same table under differnet relationship. $contentPack = ContentPack::find($id); $cloned_pack_goals = DB::table(‘content_pack_goal’)->where(‘content_pack_id’ , $contentPack->id)->get(); $cloned_pack_goal_ids = $cloned_pack_goals->goal_id; Produces Exception Exception Property [goal_id] does not exist on this collection instance. dd($cloned_pack_goals); outputs: Illuminate\Support\Collection {#2466 ▼ #items: array:2 [▼ 0 => {#3129 ▼… Read More Laravel Getting id's from a table and inserting them into another table